]> git.baikalelectronics.ru Git - kernel.git/commit
macsec: RXSAs don't need to hold a reference on RXSCs
authorSabrina Dubroca <sd@queasysnail.net>
Fri, 29 Jul 2016 13:37:54 +0000 (15:37 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 31 Jul 2016 04:11:08 +0000 (21:11 -0700)
commit0c04c0307825d232b24414b939ef76b36646a8e1
tree619366c479c5678cda7783f575b1a0e64d66cd9c
parented0f546a37016e966f6b1ab576320b7a05627c13
macsec: RXSAs don't need to hold a reference on RXSCs

Following the previous patch, RXSCs are held and properly refcounted in
the RX path (instead of being implicitly held by their SA), so the SA
doesn't need to hold a reference on its parent RXSC.

This also avoids panics on module unload caused by the double layer of
RCU callbacks (call_rcu frees the RXSA, which puts the final reference
on the RXSC and allows to free it in its own call_rcu) that commit
24133da0780e ("macsec: add rcu_barrier() on module exit") didn't
protect against.
There were also some refcounting bugs in macsec_add_rxsa where I didn't
put the reference on the RXSC on the error paths, which would lead to
memory leaks.

Fixes: 4453af01ee3c ("macsec: introduce IEEE 802.1AE driver")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/macsec.c