Page MenuHomeFreeBSD

rsu: add a runtime TX buffer bound check for a kernel buffer overflow
ClosedPublic

Authored by markj on Mon, Aug 17, 8:17 PM.
Tags
None
Referenced Files
F170905484: D58898.id.diff
Mon, Sep 7, 11:43 AM
F170902289: D58898.diff
Mon, Sep 7, 11:11 AM
F170901794: D58898.diff
Mon, Sep 7, 11:07 AM
Unknown Object (File)
Mon, Sep 7, 5:25 AM
Unknown Object (File)
Sun, Sep 6, 11:58 PM
Unknown Object (File)
Sun, Sep 6, 12:51 AM
Unknown Object (File)
Sat, Sep 5, 8:24 PM
Unknown Object (File)
Sat, Sep 5, 8:24 PM
Subscribers

Details

Summary

The rsu driver currently relies on a KASSERT to prove that the mbuf payload
plus TX descriptor fits in the per-transfer USB TX buffer. On production
kernels without INVARIANTS, an oversized raw 802.11 frame can reach
m_copydata() and overwrite past that buffer, causing local kernel memory
corruption.

This suggested patch replaces the assertion-only guard with a runtime size
check before the copy. Oversized frames return EMSGSIZE, leaving the existing
caller cleanup paths responsible for freeing m0, ni, and the unused
transfer buffer.

Reachable via root / bpf access

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable