]> 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)
commitd4179f45f5423e31ef427fee90e398ebcba6f8cc
tree619366c479c5678cda7783f575b1a0e64d66cd9c
parentdc3444a06b039ed86105f89d5bec3a6aefbd6c03
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
c22f3deb5669 ("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: 4f0c7417cca8 ("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