USB: visor: fix null-deref at probe
Subsystems (3)
Johan Hovold
maintainerPATCH 1/1 USB: visor: fix null-deref at probe
Fix null-pointer dereference at probe should a (malicious) Treo device lack the expected endpoints.
Specifically, the Treo port-setup hack was dereferencing the bulk-in and interrupt-in urbs without first making sure they had been allocated by core.
--- drivers/usb/serial/visor.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/serial/visor.c +5 -0
@@ -544,6 +544,11 @@ static int treo_attach(struct usb_serial *serial) (serial->num_interrupt_in == 0))return 0 ; +if (serial->num_bulk_in <2 || serial->num_interrupt_in <2 ) { +dev_err (&serial->interface->dev,"missing endpoints\n" ); +return -ENODEV ; + } +/* * It appears that Treos and Kyoceras want to use the * 1st bulk in endpoint to communicate with the 2nd bulk out endpoint,
Signature · 1 line
2.4.10
Johan Hovold
maintainerQuoted 10 lines · Johan Hovold
Fix null-pointer dereference at probe should a (malicious) Treo device lack the expected endpoints.
Specifically, the Treo port-setup hack was dereferencing the bulk-in and interrupt-in urbs without first making sure they had been allocated by core.
Cc stable <[email protected]>Signed-off-by Johan Hovold <[email protected]>---
Vladis,
turns out the Treo devices had a similar problem.
You should be able to just use just
if (serial->num_bulk_out < 2) return -ENODEV;
for your case.
Quoted 9 lines
drivers/usb/serial/visor.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/usb/serial/visor.c +0
-0@@ -544,6 +544,11 @@ static int treo_attach(struct usb_serial *serial) (serial->num_interrupt_in == 0))
drivers/usb/serial/visor.c static int treo_attach(struct usb_serial *serial) · line 554
Quoted 10 lines
drivers/usb/serial/visor.c +5
-0return 0 ; +if (serial->num_bulk_in <2 || serial->num_interrupt_in <2 ) { +dev_err (&serial->interface->dev,"missing endpoints\n" ); +return -ENODEV ; + } +/* * It appears that Treos and Kyoceras want to use the * 1st bulk in endpoint to communicate with the 2nd bulk out endpoint,
Thanks,
Johan
Johan Hovold
maintainerQuoted 19 lines · Johan Hovold
Fix null-pointer dereference at probe should a (malicious) Treo device lack the expected endpoints.
Specifically, the Treo port-setup hack was dereferencing the bulk-in and interrupt-in urbs without first making sure they had been allocated by core.
Cc stable <[email protected]>Signed-off-by Johan Hovold <[email protected]>--- drivers/usb/serial/visor.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/usb/serial/visor.c +0
-0@@ -544,6 +544,11 @@ static int treo_attach(struct usb_serial *serial) (serial->num_interrupt_in == 0))
drivers/usb/serial/visor.c static int treo_attach(struct usb_serial *serial) · line 554
Quoted 10 lines
drivers/usb/serial/visor.c +5
-0return 0 ; +if (serial->num_bulk_in <2 || serial->num_interrupt_in <2 ) { +dev_err (&serial->interface->dev,"missing endpoints\n" ); +return -ENODEV ; + } +/* * It appears that Treos and Kyoceras want to use the * 1st bulk in endpoint to communicate with the 2nd bulk out endpoint,
Now applied.
Johan