Skip to content

Commit 93a3094

Browse files
qsndavem330
authored andcommitted
macsec: delete new rxsc when offload fails
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: 3cf3227 ("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>
1 parent 8bcd560 commit 93a3094

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/net/macsec.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,6 @@ static int macsec_add_rxsc(struct sk_buff *skb, struct genl_info *info)
18761876
struct macsec_rx_sc *rx_sc;
18771877
struct nlattr *tb_rxsc[MACSEC_RXSC_ATTR_MAX + 1];
18781878
struct macsec_secy *secy;
1879-
bool was_active;
18801879
int ret;
18811880

18821881
if (!attrs[MACSEC_ATTR_IFINDEX])
@@ -1904,7 +1903,6 @@ static int macsec_add_rxsc(struct sk_buff *skb, struct genl_info *info)
19041903
return PTR_ERR(rx_sc);
19051904
}
19061905

1907-
was_active = rx_sc->active;
19081906
if (tb_rxsc[MACSEC_RXSC_ATTR_ACTIVE])
19091907
rx_sc->active = !!nla_get_u8(tb_rxsc[MACSEC_RXSC_ATTR_ACTIVE]);
19101908

@@ -1931,7 +1929,8 @@ static int macsec_add_rxsc(struct sk_buff *skb, struct genl_info *info)
19311929
return 0;
19321930

19331931
cleanup:
1934-
rx_sc->active = was_active;
1932+
del_rx_sc(secy, sci);
1933+
free_rx_sc(rx_sc);
19351934
rtnl_unlock();
19361935
return ret;
19371936
}

0 commit comments

Comments
 (0)