macsec: fix detection of RXSCs when toggling offloading
authorSabrina Dubroca <sd@queasysnail.net>
Wed, 2 Nov 2022 21:33:15 +0000 (22:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Nov 2022 08:58:16 +0000 (09:58 +0100)
commiteeba7f07a0cbd50ba00ef77f4d1b3acb84d5c172
treeab918db87cd63f23b3a40b56778564fb771e0faf
parent3070a880eb030f1a8de9008afe1e7a3cdb40ea55
macsec: fix detection of RXSCs when toggling offloading

[ Upstream commit 80df4706357a5a06bbbc70273bf2611df1ceee04 ]

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: dcb780fb2795 ("net: macsec: add nla support for changing the offloading selection")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Antoine Tenart <atenart@kernel.org>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/macsec.c