Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp878639pxt; Fri, 6 Aug 2021 16:44:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQpd/BuS0YY3dFCoWG8hS3FjYDl/qoEVm+OqhgF0L/oxGKJkqtD7YCK3F3jscJagnkEF4x X-Received: by 2002:a17:907:6289:: with SMTP id nd9mr11934512ejc.384.1628293458630; Fri, 06 Aug 2021 16:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628293458; cv=none; d=google.com; s=arc-20160816; b=PAD6Em0k4GxEaQdB16oKC96WRxaTv+/CPfY6iyMH5MTgXhAOMV+MSk+F4kIexs2LTf TeBII2MZjQmyjEo7V4/Dr6keEz/ZkEbvnhzDW7VWbq2uF2GdgnCXTqphIlrgZitR2eXq kxOejm/a0Urz9iTgf3ARPOXlNPMfTGYy2Yy9qwo22503Llc1Y+m6y1YpxqrMv9EChaxO ASiPS7v0TLRFYgarei9PePAB8+/DpR2SONUqrPrFEcalRhSTZUqGKMW/37l1umZO9gtZ 2/DWIxWfchc0LVwvoGYowdclqNv5ik4NdkEAJX2oTs+mwHMBplj42c7G7u0xZl827O1r Kc+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:dkim-signature:dkim-signature; bh=B4fXXNqDcExo5PbK//XdrezpKXKEhtECX/f5RWkRlZM=; b=BNVwdRiZkPp7EPVoe3qYFF6mf75OegGadESAMfWA6mHcc83k2y6E3t6jQil8mBs6Kg x0VBNlMjVZEgcQa5gn5R6MdocxQfJ9SA5hx2Hxri7a+eAzUST0d2gAJzAaKTaNRTK0/M NBZsaW+NQlLrJ3WzXTpUC8GMQ8ULSjSUFBa+UexeqH4iGyrPwzAJnoq0zlJUf73WvEZJ 9LcwyK3SVvBp2xo6/IufXw+/AyxMEV1/tjZqnAnb75IlHaS05EPMcIo+0qGFyEcCLMOX +xZFiWt0lByaBUYgNTy6Uw7kRrzkmPS/sUGg/qhatqZgjOY1zOibJTyqQbCF+tX0MUdb 3Xgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@stressinduktion.org header.s=fm1 header.b=oeI36COy; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=BMKDWBvc; 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 k15si9417654eds.12.2021.08.06.16.43.55; Fri, 06 Aug 2021 16:44:18 -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=oeI36COy; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=BMKDWBvc; 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 S244589AbhHFPYI (ORCPT + 99 others); Fri, 6 Aug 2021 11:24:08 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:48209 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244480AbhHFPX7 (ORCPT ); Fri, 6 Aug 2021 11:23:59 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 69D3D5C00D5; Fri, 6 Aug 2021 11:23:37 -0400 (EDT) Received: from imap2 ([10.202.2.52]) by compute6.internal (MEProxy); Fri, 06 Aug 2021 11:23:37 -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; s=fm1; bh=B4fX XNqDcExo5PbK//XdrezpKXKEhtECX/f5RWkRlZM=; b=oeI36COyVM9U1hXuidYJ OUB3cq3QS+PVb52AWBJBSqTKV6FUxqvvN9UQMthDKepf4RfCMOtI41tKWxcsdjs+ tjEJVtZ5mYj5ihsEse+58Ym4Cc2scgOJChF9kMP94GacuL+MGS0baUYS/fJlPq6Y +7kMKFhOw1+yxuqZRjBBEGFiQlIDfGRMxsxkowM8Cu7miXuCNpTBfWmgHXyGIxro id8hv9wruBFAvY1kk8WDO0JmWSh6g1mYemoWhzAKHe6nGg2lROt2nG18v6SSlVYT r/+eWhhayDTweBKcseTydEVW76f1uNTiL1Hne9O6XcOslVHDGK6DmRFnNKtBb8YA Dg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=B4fXXN qDcExo5PbK//XdrezpKXKEhtECX/f5RWkRlZM=; b=BMKDWBvcJFPk5WNNhCEOWv v8bd8jHxiC2ZEGjZLk5EEZdfw8U0zA5K4OCp8E69nkYT3AXoSxztx8rvkJ04FPvO O+r/6MGiEbC0V1hOWCF0YuzeuTmmEb1d2sLOyNUuEcfy/TD52Zoj4INwoXZ5sXWi /yGrT+/j927HT3pILOQHvqtqneJacsLZiJqcykTjOs1zanicr765koGTVgWfqZnR 5GJnEgIDEbBp1hKA34YtL4tA1JtAHGxALptOcsxPtTR4W9KPclOezfyzGqcNkNDt PLYpY2XR3nqf1mR2LLZK3BUykCWtF7kBJl7MbqZtre/Ao/fueZqsyp8l17rhhrjw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrjedugdekgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfjfgrnhhn vghsucfhrhgvuggvrhhitgcuufhofigrfdcuoehhrghnnhgvshesshhtrhgvshhsihhnug hukhhtihhonhdrohhrgheqnecuggftrfgrthhtvghrnhepveetteehffdtgeeihfduueel heeljeeiffffueevveeugeejkeefkefffedvfedtnecuffhomhgrihhnpehkvghrnhgvlh drohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehhrghnnhgvshesshhtrhgvshhsihhnughukhhtihhonhdrohhrgh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 5115AA03D9B; Fri, 6 Aug 2021 11:23:36 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-552-g2afffd2709-fm-20210805.001-g2afffd27 Mime-Version: 1.0 Message-Id: <7ae60193-0114-46d2-9770-697a2f88b85b@www.fastmail.com> In-Reply-To: <20210806082124.96607-1-wangkefeng.wang@huawei.com> References: <20210806082124.96607-1-wangkefeng.wang@huawei.com> Date: Fri, 06 Aug 2021 17:22:55 +0200 From: "Hannes Frederic Sowa" To: "Kefeng Wang" , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, "David Miller" Cc: "Andrew Morton" , "Greg Kroah-Hartman" , "Daniel Borkmann" , "Eric Dumazet" , "Minmin chen" Subject: Re: [PATCH v2] once: Fix panic when module unload Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 6, 2021, at 10:21, Kefeng Wang wrote: > DO_ONCE > DEFINE_STATIC_KEY_TRUE(___once_key); > __do_once_done > once_disable_jump(once_key); > INIT_WORK(&w->work, once_deferred); > struct once_work *w; > w->key = key; > schedule_work(&w->work); module unload > //*the key is > destroy* > process_one_work > once_deferred > BUG_ON(!static_key_enabled(work->key)); > static_key_count((struct static_key *)x) //*access key, crash* > > When module uses DO_ONCE mechanism, it could crash due to the above > concurrency problem, we could reproduce it with link[1]. > > Fix it by add/put module refcount in the once work process. > > [1] > https://lore.kernel.org/netdev/eaa6c371-465e-57eb-6be9-f4b16b9d7cbf@huawei.com/ > > Cc: Hannes Frederic Sowa > Cc: Daniel Borkmann > Cc: David S. Miller > Cc: Eric Dumazet > Reported-by: Minmin chen > Signed-off-by: Kefeng Wang Acked-by: Hannes Frederic Sowa Thanks, Hannes