From: Abraham Arce <abraham.arce.moreno@gmail.com>
To: netdev@vger.kernel.org
Subject: KS8851: Possible NULL dereferenced in ks8851_rx_pkts
Date: Thu, 8 Apr 2010 02:03:57 -0500 [thread overview]
Message-ID: <z2ocb8016981004080003h7f5ca358r7a1a4106809909ce@mail.gmail.com> (raw)
Hi,
These changes avoid a possible dereference in skb_reserve when skb is
NULL. I am increasing rx dropped packet count but not sure about how
to handle the dump of frames. Any advice is appreciated.
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index d6dc29b..a1aa757 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -534,8 +534,11 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
if (rxlen > 0) {
skb = netdev_alloc_skb(ks->netdev, rxlen + 2 + 8);
- if (!skb) {
+ if (unlikely(!skb)) {
/* todo - dump frame and move on */
+ ks_dbg(ks, "No free memory, packet dropped\n");
+ ks->netdev->stats.rx_dropped++;
+ return;
}
/* two bytes to ensure ip is aligned, and four bytes
Best Regards
Abraham
next reply other threads:[~2010-04-08 7:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-08 7:03 Abraham Arce [this message]
2010-04-13 8:28 ` KS8851: Possible NULL dereferenced in ks8851_rx_pkts David Miller
2010-05-05 8:41 ` Abraham Arce
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=z2ocb8016981004080003h7f5ca358r7a1a4106809909ce@mail.gmail.com \
--to=abraham.arce.moreno@gmail.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).