Skip to content

Commit

Permalink
usbnet: ipheth: fix potential null pointer dereference in ipheth_carr…
Browse files Browse the repository at this point in the history
…ier_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: bb1b40c ("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>
  • Loading branch information
Gustavo A. R. Silva authored and David S. Miller committed Nov 19, 2017
1 parent 981542c commit 61c5935
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/usb/ipheth.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,15 @@ static void ipheth_sndbulk_callback(struct urb *urb)

static int ipheth_carrier_set(struct ipheth_device *dev)
{
struct usb_device *udev = dev->udev;
struct usb_device *udev;
int retval;

if (!dev)
return 0;
if (!dev->confirmed_pairing)
return 0;

udev = dev->udev;
retval = usb_control_msg(udev,
usb_rcvctrlpipe(udev, IPHETH_CTRL_ENDP),
IPHETH_CMD_CARRIER_CHECK, /* request */
Expand Down

0 comments on commit 61c5935

Please sign in to comment.