Commit c04db81
committed
net/9p: Fix buffer overflow in USB transport layer
A buffer overflow vulnerability exists in the USB 9pfs transport layer
where inconsistent size validation between packet header parsing and
actual data copying allows a malicious USB host to overflow heap buffers.
The issue occurs because:
- usb9pfs_rx_header() validates only the declared size in packet header
- usb9pfs_rx_complete() uses req->actual (actual received bytes) for
memcpy
This allows an attacker to craft packets with small declared size
(bypassing validation) but large actual payload (triggering overflow
in memcpy).
Add validation in usb9pfs_rx_complete() to ensure req->actual does not
exceed the buffer capacity before copying data.
Reported-by: Yuhao Jiang <[email protected]>
Closes: https://lkml.kernel.org/r/[email protected]
Fixes: a3be076 ("net/9p/usbg: Add new usb gadget function transport")
Cc: [email protected]
Message-ID: <[email protected]>
Signed-off-by: Dominique Martinet <[email protected]>1 parent c667c54 commit c04db81
1 file changed
+13
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| 234 | + | |
| 235 | + | |
234 | 236 | | |
235 | 237 | | |
236 | 238 | | |
| |||
242 | 244 | | |
243 | 245 | | |
244 | 246 | | |
245 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
246 | 256 | | |
247 | | - | |
| 257 | + | |
248 | 258 | | |
249 | | - | |
| 259 | + | |
250 | 260 | | |
251 | 261 | | |
252 | 262 | | |
| |||
0 commit comments