Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5422610pxu; Thu, 22 Oct 2020 01:41:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLD2/ZNyDBMUrOCfk9zMEV+GslSuzxOg+sS9JWQtjg4RYkx1WJN18KfIiLGkh48wyYuz0/ X-Received: by 2002:a17:906:3399:: with SMTP id v25mr1168444eja.51.1603356073315; Thu, 22 Oct 2020 01:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603356073; cv=none; d=google.com; s=arc-20160816; b=fr9hpGuAmr/2s63XDc3m8jtunw7xvjkGCkc8a1kPpfGmZVEI9rsnnZOABh+0rlKAmL cfIpkOehMEElXkO1jjfyb5WQvvax+C5lE/SKrk5Veq5rYR07q4YrOa8kxcw2xwy10xUD jCVkxf9YwOkjU+E6XD4JVwpeQCLsh3ePIyx4nDT2NVT6cLJJq8ylhBajatoLfFzjUwiX Uq1rE4jFTMUVaZ6Y/JT6AMXCmCBaHcO56b0/ZncqnPzA/0OVmQZue8ITTZWCXc9jSs2s 3VMJwAWBkazA7YsCiGW8PP8AFZkNiBbaSyaMl2RsmWRtplAyUXAQ58zgA4HXvpKRqnfQ QkFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=y79KFd5q6rIoOo+YgTQCQsSHeQcVTVOh1Xn0IAmIo2g=; b=DJOKxEzE3lnWF+WB7AkDfFnhf0IVO3uDzCp0iXzaouEFFpjDRCRrp9gXEQbEZ+qI6I Y6dpjc+Zd1ktwhJWzbJ8eXoKcgqvRzpCXLPPzRRPia2y2uXt/oFFOXXUO8MtGkn0p8y+ mKjFM1dDScD955XgDc+cgq3HLi/aLiq4FGrP9GPlvEDKJkSsmjHMc5R9T5opTqjvzmoi SM4ySmqxecCp2pq72dckmJWnjVeZ5Qu+hGxuZ+3rdp0F3sgb/hPhgiJt8GqnZgjK13LF lH04Q4oyxBd5B+z2I2oXvPC6BG8mb03zTZ6Ey0m44CfsfXTK+pSObfTPhFMWlmLoVz3d aa0Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zj19si444730ejb.605.2020.10.22.01.40.51; Thu, 22 Oct 2020 01:41:13 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2504342AbgJVGs0 (ORCPT + 99 others); Thu, 22 Oct 2020 02:48:26 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:37144 "EHLO fornost.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2440717AbgJVGsZ (ORCPT ); Thu, 22 Oct 2020 02:48:25 -0400 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" Cc: Steffen Klassert , "David S . Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, wsd_upstream@mediatek.com 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1603345995.13237.2.camel@mbjsdccf07> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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