From patchwork Mon Oct 24 11:29:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9322 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp465615wru; Mon, 24 Oct 2022 06:53:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yNDVKFrXfjcWnhpPpFq2Kr7RCWK/jfLeKvqdcbput3F/nOQLPL7Scd1FaP9iNxf9u8j5u X-Received: by 2002:a17:90b:2241:b0:212:e24a:5e8d with SMTP id hk1-20020a17090b224100b00212e24a5e8dmr14464425pjb.229.1666619584388; Mon, 24 Oct 2022 06:53:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619584; cv=none; d=google.com; s=arc-20160816; b=ILbWwUrdLb3/Q4CTWEoDgL++OFWl10Ow1QcF2txweNl7LvDlN2kUqIOW1NNqUB0oq2 LkWnUDitXCf2TJ0jLYemnpFETy2lqdkZWQmWqJm0jZuLS7MyTXOuh/ly3FLc/UyERfE7 PRKWF/mg5fuk6Oc4vKRlYXlUZj6uOCG/O74/+jrmH+Ml7uDm9zIJNNpKPB79HqdR4eRJ ALoJjKG9Mn0r+2ljYjw26Vcg0LiXPhN5WB9EfQVBdooA1Y6IOleyToobQ2YLzu6CT1Fi a0RjF5oas7byWgF7L1mFrTWRzUQnRXDq1MO1yFUHxsD20Y3FVk0VvEbJz6z5FkqwzDO5 YO0w== 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=KAZlGb5pCR7tBaYFAYOZ1JSCFoeDYyXaZIA6L4ocmpk=; b=E06Y/iNkth6zvSccuH2+7iZIYPaV5ATztdDWPvErxnrO92XUM+2LbQd0egaKQxVsfd cr54vo5eAxoJ1DhwCwZIWT2otoKke+W6Gt2BQSRj6eK57Q2uYhjSCYAFSW/1wLIBCzPo 5OiRxGZ053HPmQiFoHMH1XCZd56ElD8+YUk6IIBTPwfgRQNc9usm1hmOePDdmcgpBdBA lhrOig7fxf2WURntMAHnhLryqLvM+6ncH/WkkfL5Q265gBmeKCNdIc9CAAXcS29HT2B4 jjVOzgqSd33YkCP4CXg1WeVMWwCtQ551+3ETJDg1atj43h9FsCwRsjeJ++UWHjkKP8F7 UhlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bphs1z4X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a63c04a000000b0044ed36e4c57si35396393pgi.217.2022.10.24.06.52.50; Mon, 24 Oct 2022 06:53:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bphs1z4X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236029AbiJXNwe (ORCPT + 99 others); Mon, 24 Oct 2022 09:52:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233085AbiJXNvz (ORCPT ); Mon, 24 Oct 2022 09:51:55 -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 ABD05BB06C; Mon, 24 Oct 2022 05:42:37 -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 C9AE261299; Mon, 24 Oct 2022 12:42:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE641C433C1; Mon, 24 Oct 2022 12:42:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615340; bh=tiyhuEZPjajtP+igwZqaXeDfD751I7gCLOYpcZMLJFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bphs1z4X3RiT8KMTG03JJ4czz3JPZticoDc80fCJw2KIIrjEJXKdLJK8kZznuu7nj +Iz6UYYXfQN21fVAWBKTi+4lKQ5yZO3ExGlIwrGNaump6qu/PYZzEanHlf7MreaXiA hmeBedB289fRAP7a1HZJAkkhpVo8z03bNCOUU/58= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niels Dossche , Jakub Kicinski , Sasha Levin , Zbynek Michl Subject: [PATCH 5.15 196/530] eth: alx: take rtnl_lock on resume Date: Mon, 24 Oct 2022 13:29:00 +0200 Message-Id: <20221024113053.918097596@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747577297241992439?= X-GMAIL-MSGID: =?utf-8?q?1747577297241992439?= From: Jakub Kicinski [ Upstream commit 6ad1c94e1e7e374d88f0cfd77936dddb8339aaba ] Zbynek reports that alx trips an rtnl assertion on resume: RTNL: assertion failed at net/core/dev.c (2891) RIP: 0010:netif_set_real_num_tx_queues+0x1ac/0x1c0 Call Trace: __alx_open+0x230/0x570 [alx] alx_resume+0x54/0x80 [alx] ? pci_legacy_resume+0x80/0x80 dpm_run_callback+0x4a/0x150 device_resume+0x8b/0x190 async_resume+0x19/0x30 async_run_entry_fn+0x30/0x130 process_one_work+0x1e5/0x3b0 indeed the driver does not hold rtnl_lock during its internal close and re-open functions during suspend/resume. Note that this is not a huge bug as the driver implements its own locking, and does not implement changing the number of queues, but we need to silence the splat. Fixes: 4a5fe57e7751 ("alx: use fine-grained locking instead of RTNL") Reported-and-tested-by: Zbynek Michl Reviewed-by: Niels Dossche Link: https://lore.kernel.org/r/20220928181236.1053043-1-kuba@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/atheros/alx/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index 98a8698a3201..2ac5253ff89a 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c @@ -1912,11 +1912,14 @@ static int alx_suspend(struct device *dev) if (!netif_running(alx->dev)) return 0; + + rtnl_lock(); netif_device_detach(alx->dev); mutex_lock(&alx->mtx); __alx_stop(alx); mutex_unlock(&alx->mtx); + rtnl_unlock(); return 0; } @@ -1927,6 +1930,7 @@ static int alx_resume(struct device *dev) struct alx_hw *hw = &alx->hw; int err; + rtnl_lock(); mutex_lock(&alx->mtx); alx_reset_phy(hw); @@ -1943,6 +1947,7 @@ static int alx_resume(struct device *dev) unlock: mutex_unlock(&alx->mtx); + rtnl_unlock(); return err; }