* [PATCH] usbnet: ipheth: fix potential null pointer dereference in ipheth_carrier_set
@ 2017-11-17 20:02 Gustavo A. R. Silva
2017-11-19 3:24 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2017-11-17 20:02 UTC (permalink / raw)
To: David S. Miller; +Cc: linux-usb, netdev, linux-kernel, Gustavo A. R. Silva
_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>
---
drivers/net/usb/ipheth.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index ca71f6c..7275761 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)
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 */
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usbnet: ipheth: fix potential null pointer dereference in ipheth_carrier_set
2017-11-17 20:02 [PATCH] usbnet: ipheth: fix potential null pointer dereference in ipheth_carrier_set Gustavo A. R. Silva
@ 2017-11-19 3:24 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-11-19 3:24 UTC (permalink / raw)
To: garsilva; +Cc: linux-usb, netdev, linux-kernel
From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Date: Fri, 17 Nov 2017 14:02:09 -0600
> _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>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-19 3:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-17 20:02 [PATCH] usbnet: ipheth: fix potential null pointer dereference in ipheth_carrier_set Gustavo A. R. Silva
2017-11-19 3:24 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.