Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2924600pxy; Tue, 3 Aug 2021 20:12:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3rU1YCxmYg9PsoC3OOrkiA/MrHrlAWW0Aa8CD7lQfAY0MP8b41N6FRcF+tVJ66YMLeexY X-Received: by 2002:a5d:9655:: with SMTP id d21mr2705014ios.111.1628046774813; Tue, 03 Aug 2021 20:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628046774; cv=none; d=google.com; s=arc-20160816; b=Bm9QxUhmc9n1MlIjLVgO6RI5tanXXz7ZfhSfEECG8qOBPaNfUt4+E/HEOo+keD0er7 kksCqzZZWuxUhD6AWb0FWgLmWyQi+RlE0x4ySMGSSUikXQ0Lt3nf8LFYGgKsfC9BuDlE NNktpn8H8s9w1TxEoV0T3G7mX82RwVtnKZ28o/Gov8niT3q6FszxGAYArC4ECOWxBSG2 b/yVaeWalTkAvIgoDmi2Qjb5eE4tthA7iAh3K4Poosxouj8bMF0IRf0XUqt7cFsq5jdY 9gCimBlg95e9/FTjm4TNVFoQXwxndDCaSfNlIuIOkWrpbwo9KJb7aazuuEK4Yk+AhRgF 4GUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=gidB/2ZmfF0b12FLCrPk6U8rnfhNaI8u+h5KOEqc2dw=; b=rCC0wQbal925FTMtJfWmuddRMA/8JfXvSHshR41nKQ+bhv4UZlWEBSwltwONltGEdv IiyarJIcpyAGU+NCgCZVo66npWS3SfAMu4T9cgh9bN/N5ikl5HfTPoWPttMZrHqzA8Gp LFf0KV8e7nTfSbNwUrNapgbsSsmpNMYNfzQiCjNIy+Yn0LfCfKMiiOpNhDOu7plknwhK 5FKkbYw2ZVYE1u+iUIyB7Efhd7in/SYuoTku3gq+9xSbJ5ZznWF0Yd1lxGU6UFa05J/h 1oBsNKleFzqgkd3bouepbYLAs+aEk+8/5+vvWE2VAklo9WsRjuEc/SHQG6Vz6GiFfUNY D+UQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y1si992925ilm.61.2021.08.03.20.12.40; Tue, 03 Aug 2021 20:12:54 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231837AbhHDBuI (ORCPT + 99 others); Tue, 3 Aug 2021 21:50:08 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:16039 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229820AbhHDBuH (ORCPT ); Tue, 3 Aug 2021 21:50:07 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GfZMw2TxXzZxHs; Wed, 4 Aug 2021 09:46:20 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 4 Aug 2021 09:49:53 +0800 Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 4 Aug 2021 09:49:53 +0800 Subject: Re: [PATCH] once: Fix panic when module unload To: Hannes Frederic Sowa , , CC: Daniel Borkmann , David Miller , Eric Dumazet , Minmin chen , Jakub Kicinski , "Greg Kroah-Hartman" , Andrew Morton References: <20210622022138.23048-1-wangkefeng.wang@huawei.com> <6b4b7165-5438-df65-3a43-7dcb576dab93@huawei.com> <3017d4a6-8f1b-4f8b-9c73-1121f0251fde@www.fastmail.com> From: Kefeng Wang Message-ID: <09551b30-f73a-f248-5030-5c57c8457547@huawei.com> Date: Wed, 4 Aug 2021 09:49:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <3017d4a6-8f1b-4f8b-9c73-1121f0251fde@www.fastmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/8/3 17:59, Hannes Frederic Sowa wrote: > 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, >> >> Hi David, I check the history, the lib/once.c is from net/core/utils.c >> since >> >> commit 46234253b9363894a254844a6550b4cc5f3edfe8 >> Author: Hannes Frederic Sowa >> Date:   Thu Oct 8 01:20:35 2015 +0200 >> >>     net: move net_get_random_once to lib >> >> This bug is found in our product test, we want to make sure that whether >> this solution >> >> is correct or not, so could David or any others help to review this patch. >> >> 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 for your replay. Yes, that was my first thought, add THIS_MODULE to __do_once_done(), I will change to this way to fix the issue. > > Thanks and sorry for the delay, > Hannes > . >