Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: keyspan: fix potential null pointer dereference

Move control-urb dereference to after NULL-check. There is otherwise a
risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called
cppcheck.

[Johan: modify commit message somewhat ]
[gkh: remove stable tag as it's not a real problem that anyone has ever hit]

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Rickard Strandqvist and committed by
Greg Kroah-Hartman
d5afce82 df3ce23a

+2 -2
+2 -2
drivers/usb/serial/keyspan.c
··· 1535 1535 1536 1536 this_urb = p_priv->outcont_urb; 1537 1537 1538 - dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe)); 1539 - 1540 1538 /* Make sure we have an urb then send the message */ 1541 1539 if (this_urb == NULL) { 1542 1540 dev_dbg(&port->dev, "%s - oops no urb.\n", __func__); 1543 1541 return -1; 1544 1542 } 1543 + 1544 + dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe)); 1545 1545 1546 1546 /* Save reset port val for resend. 1547 1547 Don't overwrite resend for open/close condition. */