Skip to content

Commit 3cdc946

Browse files
jhovoldgregkh
authored andcommitted
USB: serial: safe_serial: fix information leak in completion handler
commit 8c76d7cd520ebffc1ea9ea0850d87a224a50c7f2 upstream. Add missing sanity check to the bulk-in completion handler to avoid an integer underflow that could be triggered by a malicious device. This avoids leaking up to 56 bytes from after the URB transfer buffer to user space. Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cf09c7d commit 3cdc946

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/usb/serial/safe_serial.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ static void safe_process_read_urb(struct urb *urb)
205205
if (!safe)
206206
goto out;
207207

208+
if (length < 2) {
209+
dev_err(&port->dev, "malformed packet\n");
210+
return;
211+
}
212+
208213
fcs = fcs_compute10(data, length, CRC10_INITFCS);
209214
if (fcs) {
210215
dev_err(&port->dev, "%s - bad CRC %x\n", __func__, fcs);

0 commit comments

Comments
 (0)