From: Jesper Juhl <jesper.juhl@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Manfred Spraul <manfred@colorfullife.com>,
Andrew de Quincey <adq_dvb@lidskialf.net>,
Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>,
davem@davemloft.net
Subject: [PATCH] fix possible NULL ptr deref in forcedeth
Date: Sat, 2 Sep 2006 22:10:25 +0200 [thread overview]
Message-ID: <200609022210.26114.jesper.juhl@gmail.com> (raw)
There seems to be a possible NULL pointer deref bug in
drivers/net/forcedeth.c::nv_loopback_test().
If dev_alloc_skb() fails, the next line will call skb_put()
with a NULL first argument which it'll then try to deref -
kaboom: a NULL pointer deref.
Found by coverity (#1337).
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
drivers/net/forcedeth.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletion(-)
--- linux-2.6.18-rc5-git6-orig/drivers/net/forcedeth.c 2006-09-02 21:34:14.000000000 +0200
+++ linux-2.6.18-rc5-git6/drivers/net/forcedeth.c 2006-09-02 22:02:13.000000000 +0200
@@ -3656,6 +3656,12 @@ static int nv_loopback_test(struct net_d
/* setup packet for tx */
pkt_len = ETH_DATA_LEN;
tx_skb = dev_alloc_skb(pkt_len);
+ if (!tx_skb) {
+ printk(KERN_ERR "dev_alloc_skb() failed during loopback test"
+ " of %s\n", dev->name);
+ ret = 0;
+ goto out;
+ }
pkt_data = skb_put(tx_skb, pkt_len);
for (i = 0; i < pkt_len; i++)
pkt_data[i] = (u8)(i & 0xff);
@@ -3720,7 +3726,7 @@ static int nv_loopback_test(struct net_d
tx_skb->end-tx_skb->data,
PCI_DMA_TODEVICE);
dev_kfree_skb_any(tx_skb);
-
+ out:
/* stop engines */
nv_stop_rx(dev);
nv_stop_tx(dev);
--
VGER BF report: U 0.499932
reply other threads:[~2006-09-02 20:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200609022210.26114.jesper.juhl@gmail.com \
--to=jesper.juhl@gmail.com \
--cc=adq_dvb@lidskialf.net \
--cc=c-d.hailfinger.devel.2006@gmx.net \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.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 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.