diff options
author | Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> | 2014-05-16 11:39:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-27 18:14:13 -0400 |
commit | d5afce82e131eb5a171afeba0bc5fefbe2417ad9 (patch) | |
tree | 0ee29f9b6e9df63e64ed94a0951b83b552c3bbeb | |
parent | df3ce23a56654bbf08e0c36ab1690cd8316a53c4 (diff) |
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>
-rw-r--r-- | drivers/usb/serial/keyspan.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index d3acaead5a81..93cb7cebda62 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -1535,14 +1535,14 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, | |||
1535 | 1535 | ||
1536 | this_urb = p_priv->outcont_urb; | 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 | /* Make sure we have an urb then send the message */ | 1538 | /* Make sure we have an urb then send the message */ |
1541 | if (this_urb == NULL) { | 1539 | if (this_urb == NULL) { |
1542 | dev_dbg(&port->dev, "%s - oops no urb.\n", __func__); | 1540 | dev_dbg(&port->dev, "%s - oops no urb.\n", __func__); |
1543 | return -1; | 1541 | return -1; |
1544 | } | 1542 | } |
1545 | 1543 | ||
1544 | dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe)); | ||
1545 | |||
1546 | /* Save reset port val for resend. | 1546 | /* Save reset port val for resend. |
1547 | Don't overwrite resend for open/close condition. */ | 1547 | Don't overwrite resend for open/close condition. */ |
1548 | if ((reset_port + 1) > p_priv->resend_cont) | 1548 | if ((reset_port + 1) > p_priv->resend_cont) |