Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp7260307imm; Sun, 20 May 2018 22:58:21 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpIC708maiE0/ib3YMM6yVRK2yUOCqTADsRLhafv6BkwvQybnVHQvHbNnmuBUaDdbrQETiW X-Received: by 2002:a63:7e54:: with SMTP id o20-v6mr3412030pgn.451.1526882301171; Sun, 20 May 2018 22:58:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526882301; cv=none; d=google.com; s=arc-20160816; b=y7ZCxCX/Fors4b+aA1qzpBd5g/H5zWJYWoBCGh2G4fZdK/3GFofk/c/ul6P44J5URI Jv7vci9UuIwSoSCIyUNXspyizmCP6vLDhHUBtDd3b7+BLAuDFI+C8ahe95dGvSBdZ6Rn b8V37hgGgwm1MuutLCjOYDCHeCA+iogBHh7wmt040UdCwjowy22migB6PoDgyrzf4Iq/ s535xZbt+w1s179puc43VLmJ7chdTZwl1tAbhv+8V+xvS8lD5LonIcSHvYUP0onGVoW/ UPrtUyZWMtyN/TzgPK6VhQ5+WVeo0ddjNkM6ZrVh/2sQ3qVLhe7whRFKplL7clAatIg4 4sMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:arc-authentication-results; bh=FAmch9xs3J+y6QzB1mg54U7EFuRXHdY8QW9fudqdlAA=; b=TjK1O+FssgaNXwp0yhiijovabvf/uFg3oVxGPPBtpw1vOcrbClY6O1olPbR+ylfrHr +JYkY1+CDhe8zu7y3aeHBEuCW5yHO2fofn3Grsp7BgzYr3+bmQNnpvt52HB6N0lX5c3t XalC17IQfmOHwI008Tj0KzmyektBsieVEpecmoqpn7Xygsz6gmzNkh1BArdPQ+G26UYj P3Rkny2mj2/2FyTfWJBkV4EdoWUw11fM1CrDgVaiZ0LeDLDRyFnlFQbdvYqzs5jYXpMH l1QBEr5C8xMdF4leaNBpG7KDKVH3zXeJYobbNxk5XS5XOGdwE14oFVETtbyX1DSDhhsk tfsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o24-v6si10123980pgv.80.2018.05.20.22.58.05; Sun, 20 May 2018 22:58:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750948AbeEUF5y (ORCPT + 99 others); Mon, 21 May 2018 01:57:54 -0400 Received: from mgwkm02.jp.fujitsu.com ([202.219.69.169]:31667 "EHLO mgwkm02.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750867AbeEUF5x (ORCPT ); Mon, 21 May 2018 01:57:53 -0400 X-Greylist: delayed 675 seconds by postgrey-1.27 at vger.kernel.org; Mon, 21 May 2018 01:57:52 EDT Received: from kw-mxoi1.gw.nic.fujitsu.com (unknown [192.168.231.131]) by mgwkm02.jp.fujitsu.com with smtp id 7c18_79ea_765e609b_72e2_4bee_9c4d_952ac3301a64; Mon, 21 May 2018 14:46:33 +0900 Received: from g01jpfmpwyt03.exch.g01.fujitsu.local (g01jpfmpwyt03.exch.g01.fujitsu.local [10.128.193.57]) by kw-mxoi1.gw.nic.fujitsu.com (Postfix) with ESMTP id 7A776AC0182 for ; Mon, 21 May 2018 14:46:33 +0900 (JST) Received: from G01JPEXCHYT14.g01.fujitsu.local (G01JPEXCHYT14.g01.fujitsu.local [10.128.194.53]) by g01jpfmpwyt03.exch.g01.fujitsu.local (Postfix) with ESMTP id 8A9F746E46E; Mon, 21 May 2018 14:46:32 +0900 (JST) Received: from G01JPEXMBYT03.g01.fujitsu.local ([10.128.194.67]) by G01JPEXCHYT14 ([10.128.194.53]) with mapi id 14.03.0352.000; Mon, 21 May 2018 14:46:32 +0900 From: "Hatayama, Daisuke" To: "'gregkh@linuxfoundation.org'" CC: "Okajima, Toshiyuki" , "linux-kernel@vger.kernel.org" , "'ebiederm@aristanetworks.com'" Subject: RE: [PATCH] kernfs: fix dentry unexpected skip Thread-Topic: [PATCH] kernfs: fix dentry unexpected skip Thread-Index: AdPuvebs2fEv/eaSRfWTwq90/56eXQCCNMlA Date: Mon, 21 May 2018 05:46:31 +0000 Message-ID: <33710E6CAA200E4583255F4FB666C4E21B5E5BAB@G01JPEXMBYT03> References: <33710E6CAA200E4583255F4FB666C4E21B5E150F@G01JPEXMBYT03> In-Reply-To: <33710E6CAA200E4583255F4FB666C4E21B5E150F@G01JPEXMBYT03> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-securitypolicycheck: OK by SHieldMailChecker v2.5.2 x-shieldmailcheckerpolicyversion: FJ-ISEC-20170217-enc x-shieldmailcheckermailid: 33204318c1e0459ca7b8108118ffb8a7 x-originating-ip: [10.124.89.120] Content-Type: text/plain; charset="iso-2022-jp" MIME-Version: 1.0 X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: linux-kernel-owner@vger.kernel.org > [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Hatayama, Daisuke > Sent: Saturday, May 19, 2018 12:43 AM > To: 'gregkh@linuxfoundation.org' > Cc: Okajima, Toshiyuki/岡嶋 寿行 ; > linux-kernel@vger.kernel.org; 'ebiederm@aristanetworks.com' > > Subject: [PATCH] kernfs: fix dentry unexpected skip > > kernfs_dir_next_pos() overlooks the situation that the dentry > corresponding to a given pos object has already been inactive. Hence, > when kernfs_dir_pos() returns the dentry with a hash value larger than > the original one, kernfs_dir_next_pos() returns the dentry next to the > one returned by kernfs_dir_pos(). As a result, the dentry returned by > kernfs_dir_pos() is skipped. > > To fix this issue, try to find a next node only when the returned > object has a hash value equal to or smaller than the original one. > > Signed-off-by: HATAYAMA Daisuke > Suggested-by: Toshiyuki Okajima > Cc: Eric W. Biederman > --- > fs/kernfs/dir.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c > index 89d1dc1..8a2f49c 100644 > --- a/fs/kernfs/dir.c > +++ b/fs/kernfs/dir.c > @@ -1622,7 +1622,7 @@ static int kernfs_dir_fop_release(struct inode *inode, > struct file *filp) > struct kernfs_node *parent, ino_t ino, struct kernfs_node *pos) > { > pos = kernfs_dir_pos(ns, parent, ino, pos); > - if (pos) { > + if (pos && pos->hash <= ino) { I found this condition still misses the case that the returend pos with the same hash value but with different name is skipped. I'll post v2 patch. > do { > struct rb_node *node = rb_next(&pos->rb); > if (!node) > -- > 1.7.1 > > >