usbnet: ipheth: fix potential null pointer dereference in ipheth_carrier_set
Subsystems (3)
PATCH 1/1 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 <[email protected]>
--- drivers/net/usb/ipheth.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/usb/ipheth.c +4 -1
@@ -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 */
Signature · 1 line
2.7.4
From: "Gustavo A. R. Silva" <[email protected]>
Date: Fri, 17 Nov 2017 14:02:09 -0600
Quoted 9 lines
_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 <[email protected]>
Applied, thanks.