[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <z2ocb8016981004080003h7f5ca358r7a1a4106809909ce@mail.gmail.com>
Date: Thu, 8 Apr 2010 02:03:57 -0500
From: Abraham Arce <abraham.arce.moreno@...il.com>
To: netdev@...r.kernel.org
Subject: KS8851: Possible NULL dereferenced in ks8851_rx_pkts
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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists