econet: failed calls to skb_share_check() and pskb_may_pull() are kernel errors, so return NET_RX_BAD

Message ID
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Mark Smith June 20, 2009, 10:07 a.m.
As per the following #define and comment in netdevice.h,

#define NET_RX_BAD              5  /* packet dropped due to kernel error */

return NET_RX_BAD when skb_share_check() or pskb_may_pull() fail in

Signed-off-by: Mark Smith <>

To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to
More majordomo info at


diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 6f479fa..b363ac5 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -1072,10 +1072,12 @@  static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
 		goto drop;
 	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
-		return NET_RX_DROP;
+		return NET_RX_BAD;
-	if (!pskb_may_pull(skb, sizeof(struct ec_framehdr)))
-		goto drop;
+	if (!pskb_may_pull(skb, sizeof(struct ec_framehdr))) {
+		kfree_skb(skb);
+		return NET_RX_BAD;
+	}
 	hdr = (struct ec_framehdr *) skb->data;