From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A629DC43217 for ; Mon, 14 Nov 2022 12:53:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237479AbiKNMxy (ORCPT ); Mon, 14 Nov 2022 07:53:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237480AbiKNMxx (ORCPT ); Mon, 14 Nov 2022 07:53:53 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A11311A12 for ; Mon, 14 Nov 2022 04:53:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BB0E86115D for ; Mon, 14 Nov 2022 12:53:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A912AC433C1; Mon, 14 Nov 2022 12:53:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1668430432; bh=ANNuYABjHgvr/IYK6TSQ+51BjL3nCDEeqEZLLPjqaYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vEb5z29WHUz6dg/SVoK6CpOrV2xxgkgqGUYxk8sSFzlzrasKwl6YUVqF6OGgY9AoA 63QVA36lZLlX/50PWVADkwcY+l+rJv4aEGxGwS3M4SQuytaNbRpa2IvKkXIG1GGLRp qHL8m+JWuo1XsFK9bfhcgYdpS5heILF1fMqfkyn0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sabrina Dubroca , Antoine Tenart , Leon Romanovsky , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 026/131] macsec: fix detection of RXSCs when toggling offloading Date: Mon, 14 Nov 2022 13:44:55 +0100 Message-Id: <20221114124449.792952146@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114124448.729235104@linuxfoundation.org> References: <20221114124448.729235104@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sabrina Dubroca [ 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 Reviewed-by: Antoine Tenart Reviewed-by: Leon Romanovsky Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/macsec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 328f6a172b84..af9b5eaf5b94 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -2558,7 +2558,7 @@ static bool macsec_is_configured(struct macsec_dev *macsec) struct macsec_tx_sc *tx_sc = &secy->tx_sc; int i; - if (secy->n_rx_sc > 0) + if (secy->rx_sc) return true; for (i = 0; i < MACSEC_NUM_AN; i++) -- 2.35.1