• Sabrina Dubroca's avatar
    macsec: RXSAs don't need to hold a reference on RXSCs · 36b232c8
    Sabrina Dubroca authored
    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
    b196c22a ("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: c09440f7 ("macsec: introduce IEEE 802.1AE driver")
    Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    36b232c8
macsec.c 82.8 KB