Commit 80df4706 authored by Sabrina Dubroca's avatar Sabrina Dubroca Committed by David S. Miller

macsec: fix detection of RXSCs when toggling offloading

macsec_is_configured incorrectly uses secy->n_rx_sc to check if some
RXSCs exist. secy->n_rx_sc only counts the number of active RXSCs, but
there can also be inactive SCs as well, which may be stored in the
driver (in case we're disabling offloading), or would have to be
pushed to the device (in case we're trying to enable offloading).

As long as RXSCs active on creation and never turned off, the issue is
not visible.

Fixes: dcb780fb ("net: macsec: add nla support for changing the offloading selection")
Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
Reviewed-by: default avatarAntoine Tenart <atenart@kernel.org>
Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 73a4b31c
...@@ -2571,7 +2571,7 @@ static bool macsec_is_configured(struct macsec_dev *macsec) ...@@ -2571,7 +2571,7 @@ static bool macsec_is_configured(struct macsec_dev *macsec)
struct macsec_tx_sc *tx_sc = &secy->tx_sc; struct macsec_tx_sc *tx_sc = &secy->tx_sc;
int i; int i;
if (secy->n_rx_sc > 0) if (secy->rx_sc)
return true; return true;
for (i = 0; i < MACSEC_NUM_AN; i++) for (i = 0; i < MACSEC_NUM_AN; i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment