This fixes hang when target device of mirred packet classifier action is removed. If a mirror or redirection action is configured to cause packets to go to another device, the classifier holds a ref count, but was assuming the adminstrator cleaned up all redirections before removing. The fix is to add a notifier and cleanup during unregister. The new list is implicitly protected by RTNL mutex because it is held during filter add/delete as well as notifier.
Showing the changes to include/net (1 of 2 files). Show all
Unified · Split
| @@ -9,6 +9,7 @@ struct tcf_mirred { · 8 unmodified lines | |||
| 9 | int tcfm_ifindex; | 9 | int tcfm_ifindex; |
| 10 | int tcfm_ok_push; | 10 | int tcfm_ok_push; |
| 11 | struct net_device *tcfm_dev; | 11 | struct net_device *tcfm_dev; |
| 12 | struct list_head tcfm_list; | ||
| 12 | }; | 13 | }; |
| 13 | #define to_mirred(pc) \ | 14 | #define to_mirred(pc) \ |
| 14 | container_of(pc, struct tcf_mirred, common) | 15 | container_of(pc, struct tcf_mirred, common) |