Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp524821rdb; Tue, 15 Aug 2023 04:27:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEx1BPbyb/V7ZLPtzE3Ul5P+jbtOimQpiNG1+g+5C9Z8N7n2QcoTYvKpjQRiNa7MXihfXdk X-Received: by 2002:a19:7718:0:b0:4ff:8a17:42eb with SMTP id s24-20020a197718000000b004ff8a1742ebmr292933lfc.66.1692098855312; Tue, 15 Aug 2023 04:27:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692098855; cv=none; d=google.com; s=arc-20160816; b=UI3P4tQYTZywdoxUd7a7dag1bxtj9TVeKWeCKhYxTcTV6p5QiwcVOLBelS66FhtczO EkNIaTVNw5tUD2OkgTsFMzH1PaBqKYTrvv04swLnRDwK63RNuUglEyw7eKO3USzY1HFS /c6urIpB+csJ1Nstf1PWpyydJC+YVhyGm6ZeYt03Nr2YR1/JR2Jh80pPLJ1GXEeVqy+q 1UdKMnRDkSLO3y4bfNxJPChfwXksLxjsLtzf8GhAjzYqqaShVsOs44Qt9GqkOBsxJQsz hSPZiEfJDgETkT35OAzFAskeXWVfp5GizQ4OcxR+JErHRnO3yzG0CAA2YLL5tN2xiQvu bDfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0ZiobANKs6QQDG6hveUSiCbK+9FbtaSIVs5wl7JUQTY=; fh=AoVE8YEduKZi594kgWnrV/LpXCqQiQA1XuVJ8MUYOOI=; b=QTWN2iiyEwUpyl7h5xxq5HngNJuHGiDPpuee/zYMj85gnlq7+GggpyhYPS4AIbtyrQ nv3cbICo5PfPLUeiaKkZYUjmZLh9/+mii3FTmeMbAZjCJCNQfHywC92FIdu9wQ55GHm6 CtQQMbC7oFwS3nSdhKps7NJX4IEshEgFonI+IEWYaNN4KGUA6RsMOZJFzL0wEW8AqUER kn74x47SZgGUidww7Ytsvq7HK0yOqjhfmyUz1ufCnosi6FA2sz/Np77y4uDrV1TXAzOq xfzGeRode7Ox6v4RXEMRoq87XmlaqK+VioIgt7yaIJQwC5HyX9mB0VqGf25AU/QFe3fO d2Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GZWSfEB1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d15-20020a1709064c4f00b0099d97da6b19si4936235ejw.790.2023.08.15.04.27.08; Tue, 15 Aug 2023 04:27:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GZWSfEB1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235554AbjHOIG3 (ORCPT + 99 others); Tue, 15 Aug 2023 04:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235548AbjHOIGD (ORCPT ); Tue, 15 Aug 2023 04:06:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15CFE172A for ; Tue, 15 Aug 2023 01:06:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A0CDE6185C for ; Tue, 15 Aug 2023 08:06:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45FBBC433C8; Tue, 15 Aug 2023 08:06:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692086761; bh=MBjm+i9oi2ovjJMqGomAYUboVzAwAtJyrjcdgX8noeU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GZWSfEB167QEpWQhBRCSB/0mt7Mx57zwzwAS1gjcDe7zXNzq1dO8d6V419dvV8dIp E7EyMkdi7QDHs7jWoD/TlVe5eHOVNd9tttE1Czn7m2K6IAedfY+oa/7gOSf0d+MCNi 07WXZd6/pKzqeRmAwtu6+KBXiG/pQOMFeoHJdF1N5RrQwJRdGyp6IfxkiGMzZMsPvE vEoRcIduM2Y8koNlu7K3xvBcRAd4XlOkrKRUZus0YY3wsKlc5+Qi/m06QEyJApm/I0 arjNyZU5wy7ploc4kHMMRt5ZPxoe9O5SWRdp0F55aLtCQVAFkPgqJCH+9EP4ra/YSq Gy/mJ8qPiCLpA== Date: Tue, 15 Aug 2023 11:05:57 +0300 From: Leon Romanovsky To: Herbert Xu Cc: Florian Westphal , Dong Chenchen , steffen.klassert@secunet.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, timo.teras@iki.fi, yuehaibing@huawei.com, weiyongjun1@huawei.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [Patch net, v2] net: xfrm: skip policies marked as dead while reinserting policies Message-ID: <20230815080557.GK22185@unreal> References: <20230814140013.712001-1-dongchenchen2@huawei.com> <20230815060026.GE22185@unreal> <20230815060454.GA2833@breakpoint.cc> <20230815073033.GJ22185@unreal> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 15, 2023 at 03:51:44PM +0800, Herbert Xu wrote: > On Tue, Aug 15, 2023 at 10:30:33AM +0300, Leon Romanovsky wrote: > > > > But policy has, and we are not interested in validity of it as first > > check in if (...) will be true for policy->walk.dead. > > > > So it is safe to call to dir = xfrm_policy_id2dir(policy->index) even > > for dead policy. > > If you dereference policy->index on a walker object it will read memory > before the start of the walker object. That could do anything, perhaps > even triggering a page fault. Where do you see walker object? xfrm_policy_id2dir() is called on policy object, which is defined as "struct xfrm_policy". Thanks > > Cheers, > -- > Email: Herbert Xu > Home Page: http://gondor.apana.org.au/~herbert/ > PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt