Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2301853pxy; Tue, 3 Aug 2021 03:02:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYf18cHYcUfYLrz26FspARh+JSGOJ7ICMO33pW0bmM6rGIuRVlBKRSXpup1GlAnNm5HUWi X-Received: by 2002:a92:c54d:: with SMTP id a13mr293824ilj.74.1627984925052; Tue, 03 Aug 2021 03:02:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627984925; cv=none; d=google.com; s=arc-20160816; b=OumpPPxC/BZ0mgXnSwGu+rEemJKdiIp+BlT+ZJzadUTrV9AJrOAH4sD+jjt2Do/3bd gfUf0xOPWt9suvjsfWNyN1h8o8I/EA0dzgYeIcRqcJjCw8SD9aDieMOlM8csajglQ9WE ZVuZibweod/8YlmQUqeixOPKXLPpl/26q4bKtzA2fMTE+XieHtG0kylJN66LbOMewtGD EjRUZfFmogMsl+qHi8lLIrHAX1IxxvNb4RSTjTjq4vIXYsciarSyMoLISdbGMSTNubG9 EsLsFBYMpXUtZT8HJwIRS9ksWyXtYoDKFB4lwJ6YipHucBTSnOqzpRZHXbfrKvbuiaYS LwVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:cc:to:from :date:references:in-reply-to:message-id:mime-version:user-agent :dkim-signature:dkim-signature; bh=7MOKSRsCMH6zaAuqEMxQ0nBzsknZxPnxgUSZXXmE6pY=; b=se5kaEPKzF8u1aAcGo+X2mtXisQoNFUqJDSmYdCDCpRHQ0arS+CssvduGhYZOKeN/Z x0gJtuR5Gk4AEml5Yz9CxenXbFsOzX6P5HJxZV6tSbXStIkbTcbiB0n1BTExNsPisirg 3G0sq+up9YRREGvLzP9PpYQ/mZ8b2k2Oz/iH0CDXc2OFDhBKx3VVRYrlDbd1vn44YrMR mWasNJaFgvlRmglnkQb7yQap1mTGQ9QbTOxoCcgBzSJRtOiTSgNPWq0uIgLIGjGoC0Ih j2ZslrtVvUHE5ZXWhFT6y5zem3O+asWRqmRWYvuwULRgpZ31UKItHKUwuKrsL9H20Mhd 13hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@stressinduktion.org header.s=fm1 header.b=BH1hGW63; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=C9EfJTJd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p20si15226998ioo.40.2021.08.03.03.01.51; Tue, 03 Aug 2021 03:02:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@stressinduktion.org header.s=fm1 header.b=BH1hGW63; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=C9EfJTJd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235070AbhHCKAK (ORCPT + 99 others); Tue, 3 Aug 2021 06:00:10 -0400 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:50077 "EHLO wout4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234813AbhHCKAJ (ORCPT ); Tue, 3 Aug 2021 06:00:09 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 7261032000E5; Tue, 3 Aug 2021 05:59:57 -0400 (EDT) Received: from imap2 ([10.202.2.52]) by compute6.internal (MEProxy); Tue, 03 Aug 2021 05:59:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= stressinduktion.org; h=mime-version:message-id:in-reply-to :references:date:from:to:cc:subject:content-type :content-transfer-encoding; s=fm1; bh=7MOKSRsCMH6zaAuqEMxQ0nBzsk nZxPnxgUSZXXmE6pY=; b=BH1hGW63xEVTH006soeZzDp/hWzOKPGgVOK/mCWE1K kRNUMTXsQSrDZDkgmE3YE7V2F1RIET+WxGtEVVpNS7/U0xSrIA4cuR7X1SbVyJox 4J/t90J18D3y+kszpaYwvsw/qGbRqaEqSD926xpDqEd869LYgmc3T6Fk10Jon9Hx vdS671wG+zc8pzAXB/oI4ujZBOzU+1nF2QrZSzRlqh/3i04w7ieQHnhwM8L+aFew 1XvNRDbIkY72M8VWXo3xa+It3+5vUf30OCvAZ6ACneo6+viACuK8k7T+/wYwecWz f+QAEScupr/nJpu3IK8OLe9lzKrt0fc5QjhxY3n5Cb1w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=7MOKSRsCMH6zaAuqEMxQ0nBzsknZxPnxgUSZXXmE6 pY=; b=C9EfJTJdrsw9Kd8X9FeBdn+T8NizhLdGPQgTmpDUSKTfGIbvHCCfywbfw QAGw3a+9YbRYQ28FQgC/ZoDr1XCpR/dmDFcr0hsXQJiBSNgeHUMNFYmg/XgzGCE9 CMw+HsrLC+lx2S/UXDWeeixVlPWhsDAzuCsYwmCSeLL2kuLwH+gLTdTNBMc9jh2m D39yBI+veEb5Bl+v28CxnZzKm8tHxuy8QD8bZyIm8WHsVq7ItkWfk7duvNAeEKw0 7n3P+O6f9xWY84hD5R35HbYC4zA6pX/Ee1c+XAUMlzFjGiF7UL1+xFJzgwwsQ8Nf AHZjvGETZnOH4eulQoDRooC57Xy8A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrieeggddvtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdfjrghn nhgvshcuhfhrvgguvghrihgtucfuohifrgdfuceohhgrnhhnvghssehsthhrvghsshhinh guuhhkthhiohhnrdhorhhgqeenucggtffrrghtthgvrhhnpeevhfevteelkeefgeeftddv heejgffgjedvleetffeujeetjedvtdduteelvdetleenucffohhmrghinhepkhgvrhhnvg hlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhephhgrnhhnvghssehsthhrvghsshhinhguuhhkthhiohhnrdhorhhg X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 292DBA03DA9; Tue, 3 Aug 2021 05:59:55 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-548-g3a0b1fef7b-fm-20210802.001-g3a0b1fef Mime-Version: 1.0 Message-Id: <3017d4a6-8f1b-4f8b-9c73-1121f0251fde@www.fastmail.com> In-Reply-To: <6b4b7165-5438-df65-3a43-7dcb576dab93@huawei.com> References: <20210622022138.23048-1-wangkefeng.wang@huawei.com> <6b4b7165-5438-df65-3a43-7dcb576dab93@huawei.com> Date: Tue, 03 Aug 2021 11:59:34 +0200 From: "Hannes Frederic Sowa" To: "Kefeng Wang" , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: "Daniel Borkmann" , "David Miller" , "Eric Dumazet" , "Minmin chen" , "Jakub Kicinski" , "Greg Kroah-Hartman" , "Andrew Morton" Subject: Re: [PATCH] once: Fix panic when module unload Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Tue, Aug 3, 2021, at 04:11, Kefeng Wang wrote: > Hi ALL, I don't know who maintain the lib/once.c, add Greg and Andrew = too, >=20 > Hi David, I check the history, the lib/once.c is from net/core/utils.c= =20 > since >=20 > commit 46234253b9363894a254844a6550b4cc5f3edfe8 > Author: Hannes Frederic Sowa > Date:=C2=A0=C2=A0 Thu Oct 8 01:20:35 2015 +0200 >=20 > =C2=A0=C2=A0=C2=A0 net: move net_get_random_once to lib >=20 > This bug is found in our product test, we want to make sure that wheth= er=20 > this solution >=20 > is correct or not, so could David or any others help to review this pa= tch. >=20 > Many thinks. Thanks for the patch. I see that it got marked as not applicable for the net trees: Back then I added this code via the net/ tree thus I think it should get= picked up nonetheless hopefully. Regarding your patch, I think it mostly looks fine: It might be worthwhile to increment the reference counter inside the preempt disabled bracket in find_module_by_key (and thus also rename that function to make this fact more clear). The other option would be to use the macro DO_ONCE and always pass in THIS_MODULE from there, increment its ref counter in once_disable_jump. This might be more canonical. Thanks and sorry for the delay, Hannes