Commit 8deff4af8745561efd2be34ee30cc57a6f0107c6

Authored by alex.bluesman.smirnov@gmail.com
Committed by David S. Miller
1 parent 0848e40430

6lowpan: clean up fragments list if module unloaded

Clean all the pending fragments and relative timers if 6lowpan link
is going to be deleted.

Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 11 additions and 2 deletions Side-by-side Diff

net/ieee802154/6lowpan.c
... ... @@ -1177,10 +1177,19 @@
1177 1177 {
1178 1178 struct lowpan_dev_info *lowpan_dev = lowpan_dev_info(dev);
1179 1179 struct net_device *real_dev = lowpan_dev->real_dev;
1180   - struct lowpan_dev_record *entry;
1181   - struct lowpan_dev_record *tmp;
  1180 + struct lowpan_dev_record *entry, *tmp;
  1181 + struct lowpan_fragment *frame, *tframe;
1182 1182  
1183 1183 ASSERT_RTNL();
  1184 +
  1185 + spin_lock(&flist_lock);
  1186 + list_for_each_entry_safe(frame, tframe, &lowpan_fragments, list) {
  1187 + del_timer(&frame->timer);
  1188 + list_del(&frame->list);
  1189 + dev_kfree_skb(frame->skb);
  1190 + kfree(frame);
  1191 + }
  1192 + spin_unlock(&flist_lock);
1184 1193  
1185 1194 mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx);
1186 1195 list_for_each_entry_safe(entry, tmp, &lowpan_devices, list) {