From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5529C4363A for ; Thu, 22 Oct 2020 06:50:27 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 54F1C223BF for ; Thu, 22 Oct 2020 06:50:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GnDeiXn0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54F1C223BF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gondor.apana.org.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wB4XlKjIC4/6NYiUPw/b/LGJYAva9Ru6syDkLzf5xOA=; b=GnDeiXn0ObjHpQFf6ZmRa0EKP bohEzNanQ3e6R5lFfb472iZlMM1p7Y5OfuRzv6KLLtdiEbNptU2C3YsjEO5zj9fxxi1zAoL4Cr1d7 9kC9zWXR10JaVy0Gd95DvMrTdn/FuCxfMKou5wXFw4q3qfSRB6KsX9Jm0Yvs4tec1PeAjJfRnuyrG 1c7+0K4gw/6pIGdejex48awk6Ie+Aj7aNMyxQVqx/2q98KmkQ70l7eKbTFDFckcJpCMglAygUKD8x LOfo4HgD+kSMJSKMqpfCsRMwLDMwETq68E8JgQqA0QwhGX+ShxGUqyALU7gpTzZ167ViJB5+m8U/w s9UuIN+7A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVUOl-0007uC-2J; Thu, 22 Oct 2020 06:48:31 +0000 Received: from helcar.hmeau.com ([216.24.177.18] helo=fornost.hmeau.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVUOh-0007tL-Eq; Thu, 22 Oct 2020 06:48:28 +0000 Received: from gwarestrin.arnor.me.apana.org.au ([192.168.0.7]) by fornost.hmeau.com with smtp (Exim 4.92 #5 (Debian)) id 1kVUON-00077a-V1; Thu, 22 Oct 2020 17:48:09 +1100 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Thu, 22 Oct 2020 17:48:07 +1100 Date: Thu, 22 Oct 2020 17:48:07 +1100 From: Herbert Xu To: "zhuoliang.zhang" Subject: Re: [PATCH] net: xfrm: fix a race condition during allocing spi Message-ID: <20201022064807.GA16043@gondor.apana.org.au> References: <20201020081800.29454-1-zhuoliang.zhang@mediatek.com> <20201021071222.GA11474@gondor.apana.org.au> <1603345995.13237.2.camel@mbjsdccf07> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1603345995.13237.2.camel@mbjsdccf07> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201022_024827_535844_16F3F140 X-CRM114-Status: GOOD ( 10.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Steffen Klassert , wsd_upstream@mediatek.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Matthias Brugger , Jakub Kicinski , "David S . Miller" , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 22, 2020 at 01:53:15PM +0800, zhuoliang.zhang wrote: > > there are 2 related hash lists : net->xfrm.state_bydst and > net->xfrm.state_byspi: > > 1. a new state x is alloced in xfrm_state_alloc() and added into the > bydst hlist in __find_acq_core() on the LHS; > 2. on the RHS, state_hash_work thread travels the old bydst and tranfers > every xfrm_state (include x) to the new bydst hlist and new byspi hlist; > 3. user thread on the LHS gets the lock and adds x to the new byspi > hlist again. Good catch. Please add a Fixes header. I think this was introduced with the dynamic resizing in f034b5d4efdfe0fb9e2a1ce1d95fa7914f24de49. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel