mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 13:37:36 +02:00
macsec: delete new rxsc when offload fails
[ Upstream commit93a3094782] Currently we get an inconsistent state: - netlink returns the error to userspace - the RXSC is installed but not offloaded Then the device could get confused when we try to add an RXSA, because the RXSC isn't supposed to exist. Fixes:3cf3227a21("net: macsec: hardware offloading infrastructure") 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>
This commit is contained in:
parent
50868de7dc
commit
3b05d9073a
|
|
@ -1867,7 +1867,6 @@ static int macsec_add_rxsc(struct sk_buff *skb, struct genl_info *info)
|
||||||
struct macsec_rx_sc *rx_sc;
|
struct macsec_rx_sc *rx_sc;
|
||||||
struct nlattr *tb_rxsc[MACSEC_RXSC_ATTR_MAX + 1];
|
struct nlattr *tb_rxsc[MACSEC_RXSC_ATTR_MAX + 1];
|
||||||
struct macsec_secy *secy;
|
struct macsec_secy *secy;
|
||||||
bool was_active;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!attrs[MACSEC_ATTR_IFINDEX])
|
if (!attrs[MACSEC_ATTR_IFINDEX])
|
||||||
|
|
@ -1895,7 +1894,6 @@ static int macsec_add_rxsc(struct sk_buff *skb, struct genl_info *info)
|
||||||
return PTR_ERR(rx_sc);
|
return PTR_ERR(rx_sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
was_active = rx_sc->active;
|
|
||||||
if (tb_rxsc[MACSEC_RXSC_ATTR_ACTIVE])
|
if (tb_rxsc[MACSEC_RXSC_ATTR_ACTIVE])
|
||||||
rx_sc->active = !!nla_get_u8(tb_rxsc[MACSEC_RXSC_ATTR_ACTIVE]);
|
rx_sc->active = !!nla_get_u8(tb_rxsc[MACSEC_RXSC_ATTR_ACTIVE]);
|
||||||
|
|
||||||
|
|
@ -1922,7 +1920,8 @@ static int macsec_add_rxsc(struct sk_buff *skb, struct genl_info *info)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
rx_sc->active = was_active;
|
del_rx_sc(secy, sci);
|
||||||
|
free_rx_sc(rx_sc);
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user