Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3136399imw; Wed, 6 Jul 2022 18:31:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u0SNHqnpPEyJZOaAmBJ+PeJBEDbOMCK9KzlHUn2xrjjDgSfc7Ik5j2XPQyc1kYee4IPK8g X-Received: by 2002:a17:90a:ff17:b0:1ef:8b4b:8cc0 with SMTP id ce23-20020a17090aff1700b001ef8b4b8cc0mr1955011pjb.155.1657157512288; Wed, 06 Jul 2022 18:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657157512; cv=none; d=google.com; s=arc-20160816; b=avpzjqv6Iz4OX+HIdUfCAnxtWj93AQNUIVfFx+a7WhX+1YFJNFHWKwNBT9IEEoyzIi lCxFxZd8umkUDLQqcyXGapQdbh8ogp20EvKejtcCcaD/vbGEwfrTaZDRymhOi3ZOpkrf PABpcUkCTzONwXpEdmiUhMCgBDfCgT5Bqu/YVqQbwvtple0D5XBsRCVkMyCt3qK50hsq hyYXA61EzJyrgMJXBqC5i0qDwYhTvrb2bG+fSjInJ73Sm6ZIZAt5zsTwvLg3XiwBHkEL E/SiJkCpEcQQ+ClMvxLuNvd3CGEv7N0XgXADXB35Y3lOEs/4ZejKgrQslsBP5EV46P3K T73w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=RN1RnaRoHuVYiMlCmWR+DMhf9XjO/nS4034GJdMirF4=; b=ol5550GqKu6to35bv6qYxipt2EvjyOmZVz6/o0QS+p/x1CD3Toc2yFEuWwpkFQN2Z/ 3ZuTABWWudpyva+taQcgf6mVG65o5mfwE067siQNaeUbdtIvLJEqvdIr8+4QrEKEimgI MeewnVsgleFxm3M0wWnVC3V1KHKUlVsgucDGjG5BpRaQKoWu5JVRzTRVHHSBndg/UEkE s7RQ3fV98GtbK39Qts1Vub6wfPtrPj0sxrF/j25ryx32LAHGeAwHQfYqkwPRfmkykPEX ejSQTky5inD5UTeMxQjFtfUXlt7jAFnduLdfjCg7AFO7Pp+/bA9DsZFjaQ590NiiEF26 IdAQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020a65458b000000b0040cf043ed35si36186890pgq.814.2022.07.06.18.31.40; Wed, 06 Jul 2022 18:31:52 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234655AbiGGBZv (ORCPT + 99 others); Wed, 6 Jul 2022 21:25:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234404AbiGGBZv (ORCPT ); Wed, 6 Jul 2022 21:25:51 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CFA82E6BA; Wed, 6 Jul 2022 18:25:49 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Lddvs22zVzhYst; Thu, 7 Jul 2022 09:23:21 +0800 (CST) Received: from dggpemm100009.china.huawei.com (7.185.36.113) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 7 Jul 2022 09:25:37 +0800 Received: from [10.174.179.24] (10.174.179.24) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 7 Jul 2022 09:25:36 +0800 Subject: Re: [PATCH 5.15 v3] mm/filemap: fix UAF in find_lock_entries To: Matthew Wilcox References: <20220706074527.1406924-1-liushixin2@huawei.com> CC: Greg Kroah-Hartman , Andrew Morton , Jan Kara , William Kucharski , Christoph Hellwig , , From: Liu Shixin Message-ID: <536cb9e4-983d-80db-6590-44ae7fc02415@huawei.com> Date: Thu, 7 Jul 2022 09:25:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.24] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 2022/7/6 22:08, Matthew Wilcox wrote: > On Wed, Jul 06, 2022 at 03:45:27PM +0800, Liu Shixin wrote: >> rcu_read_lock(); >> while ((page = find_get_entry(&xas, end, XA_PRESENT))) { >> + unsigned long next_idx = xas.xa_index; > It's confusing to have next_idx not be the actual next index. > That was why I made it 'xas.xa_index + 1'. I know it's somewhat > used as an indicator that we don't need to call xas_set(), and so > it doesn't really matter, but let's say what we mean. I'll modify it and resend again, thanks. > > > . >