The functions lowpan_give_skb_to_devices and process_data can return a negative error code as well as NET_RX_XXX values. Before this patch if either function returned an error code it would return NET_RX_SUCCESS even though the skb would have been freed.
Signed-off-by: Martin Townsend <martin.towns...@xsilon.com> --- net/ieee802154/6lowpan_rtnl.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/net/ieee802154/6lowpan_rtnl.c b/net/ieee802154/6lowpan_rtnl.c index 0f5a69e..a970c8c 100644 --- a/net/ieee802154/6lowpan_rtnl.c +++ b/net/ieee802154/6lowpan_rtnl.c @@ -448,7 +448,6 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { struct ieee802154_hdr hdr; - int ret; skb = skb_share_check(skb, GFP_ATOMIC); if (!skb) @@ -471,31 +470,23 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev, /* Pull off the 1-byte of 6lowpan header. */ skb_pull(skb, 1); - ret = lowpan_give_skb_to_devices(skb, NULL); - if (ret == NET_RX_DROP) + if (lowpan_give_skb_to_devices(skb, NULL) != NET_RX_SUCCESS) goto drop; } else { switch (skb->data[0] & 0xe0) { case LOWPAN_DISPATCH_IPHC: /* ipv6 datagram */ - ret = process_data(skb, &hdr); - if (ret == NET_RX_DROP) + if (process_data(skb, &hdr) != NET_RX_SUCCESS) goto drop; break; case LOWPAN_DISPATCH_FRAG1: /* first fragment header */ - ret = lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAG1); - if (ret == 1) { - ret = process_data(skb, &hdr); - if (ret == NET_RX_DROP) + if (lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAG1) == 1) + if (process_data(skb, &hdr) != NET_RX_SUCCESS) goto drop; - } break; case LOWPAN_DISPATCH_FRAGN: /* next fragments headers */ - ret = lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAGN); - if (ret == 1) { - ret = process_data(skb, &hdr); - if (ret == NET_RX_DROP) + if (lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAGN) == 1) + if (process_data(skb, &hdr) != NET_RX_SUCCESS) goto drop; - } break; default: break; -- 1.9.1 ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ Linux-zigbee-devel mailing list Linux-zigbee-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel