Commit 387e2b0439026aa738a9edca15a57e5c0bcb4dfc

Authored by Stephen Hemminger
Committed by David S. Miller
1 parent 4a06373913

[BRIDGE]: need to ref count the LLC sap

Bridge will OOPS on removal if other application has the SAP open.
The bridge SAP might be shared with other usages, so need
to do reference counting on module removal rather than explicit
close/delete.

Since packet might arrive after or during removal, need to clear
the receive function handle, so LLC only hands it to user (if any).

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

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

... ... @@ -55,7 +55,7 @@
55 55  
56 56 static void __exit br_deinit(void)
57 57 {
58   - llc_sap_close(br_stp_sap);
  58 + rcu_assign_pointer(br_stp_sap->rcv_func, NULL);
59 59  
60 60 #ifdef CONFIG_BRIDGE_NETFILTER
61 61 br_netfilter_fini();
... ... @@ -67,6 +67,7 @@
67 67  
68 68 synchronize_net();
69 69  
  70 + llc_sap_put(br_stp_sap);
70 71 br_fdb_get_hook = NULL;
71 72 br_fdb_put_hook = NULL;
72 73