]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: phy: mscc: macsec: reject PN update requests
authorRadu Pirea (NXP OSS) <radu-nicolae.pirea@oss.nxp.com>
Thu, 5 Oct 2023 18:06:35 +0000 (21:06 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Oct 2023 21:05:34 +0000 (23:05 +0200)
[ Upstream commit e0a8c918daa58700609ebd45e3fcd49965be8bbc ]

Updating the PN is not supported.
Return -EINVAL if update_pn is true.

The following command succeeded, but it should fail because the driver
does not update the PN:
ip macsec set macsec0 tx sa 0 pn 232 on

Fixes: 28c5107aa904 ("net: phy: mscc: macsec support")
Signed-off-by: Radu Pirea (NXP OSS) <radu-nicolae.pirea@oss.nxp.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/phy/mscc/mscc_macsec.c

index c00eef457b8500041e0397b8b4333323a6a3b993..bec270785c5941a93380ba3bdb12df731a075a5f 100644 (file)
@@ -880,6 +880,9 @@ static int vsc8584_macsec_upd_rxsa(struct macsec_context *ctx)
 {
        struct macsec_flow *flow;
 
+       if (ctx->sa.update_pn)
+               return -EINVAL;
+
        flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR);
        if (IS_ERR(flow))
                return PTR_ERR(flow);
@@ -929,6 +932,9 @@ static int vsc8584_macsec_upd_txsa(struct macsec_context *ctx)
 {
        struct macsec_flow *flow;
 
+       if (ctx->sa.update_pn)
+               return -EINVAL;
+
        flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR);
        if (IS_ERR(flow))
                return PTR_ERR(flow);