Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2269741pxp; Mon, 21 Mar 2022 15:28:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQRW4CkDitBmJvwDLB/nY2+x1bqBpV4hjbzc64veGMM+ZCTCUdKiB3Lofl9RxnhVu4K8HG X-Received: by 2002:a17:902:ecc6:b0:154:31a3:e036 with SMTP id a6-20020a170902ecc600b0015431a3e036mr12760936plh.154.1647901682368; Mon, 21 Mar 2022 15:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647901682; cv=none; d=google.com; s=arc-20160816; b=OFXj5W1Owt2MBhioEQacnnIsHrCEPl4OH57CphCnZxO24BG5JufS9jmfu3UfEzLNiF DzY4tkntLDbB9Pupf1SKIV7evj3oURSIhcZESf+sMCUXTiyYXy4YqeYqnySkNYiUv/NI lhDPAOHe8FtT/N3VgZz9ZpqTQ9SnUauQZ4aSDd9PWfb3u4H+e7NhSxrA5zWDpb3ASNGJ FjzndBL7FViJCX3UqKcsfLzSn4fO4CUq841WMVd9Ek7KnFs3cUBznwQgwC9Flkq3hk8H luVY9htrY8QxZUYibCDjXs26IUWTq89zd7Ymnx9IooXBeeDRJsqi/tywmfswtmXtmeEt Facg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zmoGdkv+6ZdWjVVPp3plELCnj8QV9ldAzElnnQovd6o=; b=mtMei6+LfaiBeTBVWjPLge0N2uHM+5APVeJtDdYKhH+YJJDDCAcIlTBXPD6zSp3wrW ZIihPci4j3ZfaxUSMLTezE/0+EzLFw0WoSJS/EhH1b1Lf4k7M2C/wVWm8ibCOgV2KRse KJPrIfbxr/3jg3b7tGan0zBM9K9FD0yoQDQnJKORfiWKqHLKOTD5ga/p9j0lmyBoqONT Hm9DXNdX5qCv6WC6rp8Uer9pDGo/Nb9jrN0DgNKiVpadFH2OiUr3yGZnJtIUmvitDLM2 DXD0r6FxNDSWJh+//bmt377k54VKIwsfxTW9UrJgkCM2lvdwJHrc1YoHsstp/8C95aiV gEhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q4dmZsjx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c19-20020a170902849300b00153b2d16571si3009467plo.377.2022.03.21.15.28.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:28:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q4dmZsjx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DCFC83997E1; Mon, 21 Mar 2022 14:42:17 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351827AbiCUOLz (ORCPT + 99 others); Mon, 21 Mar 2022 10:11:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348939AbiCUOEO (ORCPT ); Mon, 21 Mar 2022 10:04:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53ED318116C; Mon, 21 Mar 2022 07:01:21 -0700 (PDT) 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 93F3361331; Mon, 21 Mar 2022 14:01:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98E96C340F4; Mon, 21 Mar 2022 14:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871279; bh=UVpzg8vkB+appVM0yGsFhEW2xTZ4hJwU+sV8X/KCqV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q4dmZsjxLT1mkKXhLxeo4kBgQ++/p7BbCQVZD0B8kG42fflA+D2EtrIwy6WpZVO+g taVKWrxB81MgQu4dnftWDQvNZTspXeE+Q+fEftcvNtifo+y9i+S60yzGWL4OSA4srF OaJkjeqXRPMRRKhqaCB0hG3uZwhAZs37ZYwLKaPg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niels Dossche , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 07/32] alx: acquire mutex for alx_reinit in alx_change_mtu Date: Mon, 21 Mar 2022 14:52:43 +0100 Message-Id: <20220321133220.776790538@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133220.559554263@linuxfoundation.org> References: <20220321133220.559554263@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Niels Dossche [ Upstream commit 46b348fd2d81a341b15fb3f3f986204b038f5c42 ] alx_reinit has a lockdep assertion that the alx->mtx mutex must be held. alx_reinit is called from two places: alx_reset and alx_change_mtu. alx_reset does acquire alx->mtx before calling alx_reinit. alx_change_mtu does not acquire this mutex, nor do its callers or any path towards alx_change_mtu. Acquire the mutex in alx_change_mtu. The issue was introduced when the fine-grained locking was introduced to the code to replace the RTNL. The same commit also introduced the lockdep assertion. Fixes: 4a5fe57e7751 ("alx: use fine-grained locking instead of RTNL") Signed-off-by: Niels Dossche Link: https://lore.kernel.org/r/20220310232707.44251-1-dossche.niels@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/atheros/alx/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index 4ea157efca86..98a8698a3201 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c @@ -1181,8 +1181,11 @@ static int alx_change_mtu(struct net_device *netdev, int mtu) alx->hw.mtu = mtu; alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE); netdev_update_features(netdev); - if (netif_running(netdev)) + if (netif_running(netdev)) { + mutex_lock(&alx->mtx); alx_reinit(alx); + mutex_unlock(&alx->mtx); + } return 0; } -- 2.34.1