netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* KS8851: Possible NULL dereferenced in ks8851_rx_pkts
@ 2010-04-08  7:03 Abraham Arce
  2010-04-13  8:28 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Abraham Arce @ 2010-04-08  7:03 UTC (permalink / raw)
  To: netdev

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-05  8:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-08  7:03 KS8851: Possible NULL dereferenced in ks8851_rx_pkts Abraham Arce
2010-04-13  8:28 ` David Miller
2010-05-05  8:41   ` Abraham Arce

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).