Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1270295

[PATCH] ovl: check dentry positiveness in ovl_cleanup_whiteouts()

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Newsgroups linux.kernel
Subject [PATCH] ovl: check dentry positiveness in ovl_cleanup_whiteouts()
Date Mon, 16 Nov 2015 16:50:01 +0100
Message-ID <qvucx-It-7@gated-at.bofh.it> (permalink)
X-Original-To David Howells <dhowells@redhat.com>, Miklos Szeredi <miklos@szeredi.hu>
X-Greylist delayed 314 seconds by postgrey-1.27 at vger.kernel.org; Mon, 16 Nov 2015 10:49:29 EST
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1447688652; bh=/FfojZoTIKkUJPrcvux/HVNV8xG7hBA4ZG9zWG2nIOQ=; h=Subject:From:To:Cc:Date:Message-ID:User-Agent:MIME-Version: Content-Type:Content-Transfer-Encoding; b=sMBRGhZoSumEpechEapzVXOACW4q3sTtFU633ZPOmLrlkIf147Z4RxfepWXUrT7A8 IKjK8YfJArCJ4bXKiCHHJ0WXHtchNKOZ74V64+1MP4ln+PcSPVv3lir6QJkXgthqGw 4mvPvD1qzr7YEek4ib0Ugp/i029gVIDn6CCf1YuU=
Authentication-Results smtpcorp4.mail.yandex.net; dkim=pass header.i=@yandex-team.ru
User-Agent StGit/0.17.1-dirty
MIME-Version 1.0
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 41
Organization linux.* mail to news gateway
X-Original-Cc Al Viro <viro@zeniv.linux.org.uk>, linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux-unionfs@vger.kernel.org
X-Original-Date Mon, 16 Nov 2015 18:44:11 +0300
X-Original-Message-ID <20151116154411.6862.28435.stgit@buzz>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1270295

Show key headers only | View raw


This patch fixes kernel crash at removing directory which contains
whiteouts from lower layers.

Cache of directory content passed as "list" contains entries from all
layers, including whiteouts from lower layers. So, lookup in upper dir
(moved into work at this stage) will return negative entry. Plus this
cache is filled long before and we can race with external removal.

Example:
 mkdir -p lower0/dir lower1/dir upper work overlay
 touch lower0/dir/a lower0/dir/b
 mknod lower1/dir/a c 0 0
 mount -t overlay none overlay -o lowerdir=lower1:lower0,upperdir=upper,workdir=work
 rm -fr overlay/dir

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: Stable <stable@vger.kernel.org> # 3.18+
---
 fs/overlayfs/readdir.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 70e9af551600..adcb1398c481 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -571,7 +571,8 @@ void ovl_cleanup_whiteouts(struct dentry *upper, struct list_head *list)
 			       (int) PTR_ERR(dentry));
 			continue;
 		}
-		ovl_cleanup(upper->d_inode, dentry);
+		if (dentry->d_inode)
+			ovl_cleanup(upper->d_inode, dentry);
 		dput(dentry);
 	}
 	mutex_unlock(&upper->d_inode->i_mutex);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] ovl: check dentry positiveness in ovl_cleanup_whiteouts() Konstantin Khlebnikov <khlebnikov@yandex-team.ru> - 2015-11-16 16:50 +0100
  Re: [PATCH] ovl: check dentry positiveness in ovl_cleanup_whiteouts() Konstantin Khlebnikov <khlebnikov@yandex-team.ru> - 2015-11-16 17:30 +0100

csiph-web