From: Vivek Kumar Bhagat <vivek.bhagat@samsung.com>
To: netdev@vger.kernel.org
Cc: nitin.j@samsung.com, hemanshu.s@samsung.com
Subject: [PATCH] usbnet: dereference after null check in usbnet_start_xmit() and __usbnet_read_cmd()
Date: Wed, 19 Aug 2015 11:21:35 +0000 (GMT) [thread overview]
Message-ID: <907196681.281711439983295252.JavaMail.weblogic@ep2mlwas02b> (raw)
usbnet_start_xmit() - If info->tx_fixup is not defined by class driver,
NULL check does not happen for skb pointer and leads to NULL dereference.
__usbnet_read_cmd() - if data pointer is passed as NULL, memcpy will
dereference NULL pointer.
Signed-off-by: Vivek Kumar Bhagat <vivek.bhagat@samsung.com>
---
drivers/net/usb/usbnet.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3c86b10..ec4d224 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1294,6 +1294,8 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
if (skb)
skb_tx_timestamp(skb);
+ else
+ goto drop;
// some devices want funky USB-level framing, for
// win32 driver (usually) and/or hardware quirks
@@ -1906,7 +1908,8 @@ static int __usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
buf = kmalloc(size, GFP_KERNEL);
if (!buf)
goto out;
- }
+ } else
+ goto out;
err = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
cmd, reqtype, value, index, buf, size,
--
1.7.9.5
next reply other threads:[~2015-08-19 11:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-19 11:21 Vivek Kumar Bhagat [this message]
2015-08-19 11:51 ` [PATCH] usbnet: dereference after null check in usbnet_start_xmit() and __usbnet_read_cmd() Bjørn Mork
2015-08-19 12:03 ` Bjørn Mork
-- strict thread matches above, loose matches on Subject: below --
2015-08-20 4:43 Vivek Kumar Bhagat
2015-08-20 7:29 ` Bjørn Mork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=907196681.281711439983295252.JavaMail.weblogic@ep2mlwas02b \
--to=vivek.bhagat@samsung.com \
--cc=hemanshu.s@samsung.com \
--cc=netdev@vger.kernel.org \
--cc=nitin.j@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox