Alexander Aring wrote: > --- a/net/ieee802154/6lowpan.c > +++ b/net/ieee802154/6lowpan.c > @@ -705,20 +705,13 @@ static int lowpan_header_create(struct sk_buff *skb, > static int lowpan_give_skb_to_devices(struct sk_buff *skb) > { > struct lowpan_dev_record *entry; > - struct sk_buff *skb_cp; > int stat = NET_RX_SUCCESS; > > rcu_read_lock(); > list_for_each_entry_rcu(entry, &lowpan_devices, list) > if (lowpan_dev_info(entry->ldev)->real_dev == skb->dev) { > - skb_cp = skb_copy(skb, GFP_ATOMIC); > - if (!skb_cp) { > - stat = -ENOMEM; > - break; > - } > - > - skb_cp->dev = entry->ldev; > - stat = netif_rx(skb_cp); > + skb->dev = entry->ldev; > + stat = netif_rx(skb); > } > rcu_read_unlock();
This looks very suspicious. We've discussed it on IRC, and while it seems reasonably to expect there to be _exactly_ one match in the list of lowpan devices, we're not 100% certain. (Does anyone know for sure ?) I'd suggest to rewrite this change as: list_for_each_entry_rcu ... if (lowpan_dev_info ... goto found; BUG(); /* not found */ skb_cp = skb_copy(skb, GFP_ATOMIC); ... Please do this in a separate patch (can be in the same series) since this possibly changes the logic of the existing code. The BUG will catch cases where the device is no longer there. You may want to test this by flood-pinging an interface and then removing it. If there's a race, then you'll get the BUG (in which case you'd change the BUG to just discarding the skb). If a device can be used multiple times, the change would still be incorrect, but it seems that you've already excluded that possibility. Since, after the above change, the code is guaranteed to use the skb exactly one, you can then proceed with the removal of skb_copy. - Werner ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk _______________________________________________ Linux-zigbee-devel mailing list Linux-zigbee-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel