diff options
author | Gustavo A. R. Silva <garsilva@embeddedor.com> | 2017-11-17 15:02:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-11-18 22:23:57 -0500 |
commit | 61c59355e0154a938b28710dfa6c1d8be2ddcefa (patch) | |
tree | 965c9f92f32d6d69c92e60e1289f0274cbc1085b | |
parent | 981542c526ecd846920bc500e9989da906ee9fb9 (diff) |
usbnet: ipheth: fix potential null pointer dereference in ipheth_carrier_set
_dev_ is being dereferenced before it is null checked, hence there
is a potential null pointer dereference.
Fix this by moving the pointer dereference after _dev_ has been null
checked.
Addresses-Coverity-ID: 1462020
Fixes: bb1b40c7cb86 ("usbnet: ipheth: prevent TX queue timeouts when device not ready")
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/usb/ipheth.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index ca71f6c03859..7275761a1177 100644 --- a/drivers/net/usb/ipheth.c +++ b/drivers/net/usb/ipheth.c | |||
@@ -291,12 +291,15 @@ static void ipheth_sndbulk_callback(struct urb *urb) | |||
291 | 291 | ||
292 | static int ipheth_carrier_set(struct ipheth_device *dev) | 292 | static int ipheth_carrier_set(struct ipheth_device *dev) |
293 | { | 293 | { |
294 | struct usb_device *udev = dev->udev; | 294 | struct usb_device *udev; |
295 | int retval; | 295 | int retval; |
296 | |||
296 | if (!dev) | 297 | if (!dev) |
297 | return 0; | 298 | return 0; |
298 | if (!dev->confirmed_pairing) | 299 | if (!dev->confirmed_pairing) |
299 | return 0; | 300 | return 0; |
301 | |||
302 | udev = dev->udev; | ||
300 | retval = usb_control_msg(udev, | 303 | retval = usb_control_msg(udev, |
301 | usb_rcvctrlpipe(udev, IPHETH_CTRL_ENDP), | 304 | usb_rcvctrlpipe(udev, IPHETH_CTRL_ENDP), |
302 | IPHETH_CMD_CARRIER_CHECK, /* request */ | 305 | IPHETH_CMD_CARRIER_CHECK, /* request */ |