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


Groups > linux.kernel > #1322319

Re: [PATCH] ovl: fix getcwd() failure after unsuccessful rmdir

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Konstantin Khlebnikov <koct9i@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] ovl: fix getcwd() failure after unsuccessful rmdir
Date Sat, 30 Jan 2016 10:50:02 +0100
Message-ID <qWAki-Iy-5@gated-at.bofh.it> (permalink)
References <qOH9h-8Y-25@gated-at.bofh.it>
X-Original-To Rui Wang <rui.y.wang@intel.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=rWLn56+Xukv9n0JuRkKLlFUzr9qLgm5n4d/iorVAT3k=; b=xl9DlXi6lpnTG2GLu8shh+x0zDPVi+7mhWogHoaArOl8VU0mQRjF3c3F1KpF+uXapG lTW7Up/ng7qcttM+L2KPIHC6shVVqGcJWKCDOfqzDCOszt+3jootAHVEp1LRB4uwvXVf gpsWk6cl3bW8rnTiLUrc9o0DLY6KyvKZHkXVB1OGS+gTBflY1mvibEoscjTudgqCTm1d fWDTShTYCuioQzAKjWHd3jkiIVBzlo1nNjEO54hcQOocaXMvvrU1rTLEEydG9n4SMdzj mbFuOkwWLMkuyagsoY501dFYPGo8NHpxcClC6+imauvC2lJT9+NYQmgIAqLtRX2hR6pM Sngw==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=rWLn56+Xukv9n0JuRkKLlFUzr9qLgm5n4d/iorVAT3k=; b=FTMNW+tYZZtusMpg8knVptCt2lue8FW3F5QgfH487dzUjAdgUf3basedkejdDa9vlk ddBU9FRmoPcKE8lKuRBe3YbeKYilykd6utfFxfdXADVoTeBOpXpZv+VR14LzqBN3IHFQ hd41FGZPg9hdJF2oLDtT602Lxl+u5asgulDs5gETyPufudGvh7Dwhejx2jfufNM9VpGt Lg02xOGFD4usYm8OG64hY7QOo4PuFSOGJ0KhnC6m9MqxBCzA5EPqZS79W608233jgpsr 3jEOItDSk9ra7jQGWRmNGGA84i4j1Xmjs+wO7U7e2ZQt0uxmvEzHz5bTvv2DIMem9bK9 BMYw==
X-Gm-Message-State AG10YOQfVH1qeNPGXJk9zE5S2tacX2gt/Ab7zdvfdeMNf3t2VdQ1+k6PZU7Y6Ekgt5Z/9rj47RBPQmVDXgkYzw==
MIME-Version 1.0
X-Received by 10.25.166.130 with SMTP id p124mr2283005lfe.120.1454147054630; Sat, 30 Jan 2016 01:44:14 -0800 (PST)
Content-Type text/plain; charset=UTF-8
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 38
Organization linux.* mail to news gateway
X-Original-Cc Miklos Szeredi <miklos@szeredi.hu>, Al Viro <viro@zeniv.linux.org.uk>, linux-unionfs@vger.kernel.org, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, linux-fsdevel <linux-fsdevel@vger.kernel.org>, Vivek Goyal <vgoyal@redhat.com>
X-Original-Date Sat, 30 Jan 2016 12:44:14 +0300
X-Original-Message-ID <CALYGNiNMvxVD8yByL_3GnaH1n9nCiWjFoLGJuf3jRdLG4Rn5Sw@mail.gmail.com>
X-Original-References <1452265799-4549-1-git-send-email-rui.y.wang@intel.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1322319

Show key headers only | View raw


On Fri, Jan 8, 2016 at 6:09 PM, Rui Wang <rui.y.wang@intel.com> wrote:
> ovl_remove_upper() should do d_drop() only after it successfully
> removes the dir, otherwise a subsequent getcwd() system call will
> fail, breaking userspace programs.
>
> This is to fix: https://bugzilla.kernel.org/show_bug.cgi?id=110491
>
> Signed-off-by: Rui Wang <rui.y.wang@intel.com>

Reviewed-by: Konstantin Khlebnikov <koct9i@gmail.com>

The same problem also in ovl_remove_and_whiteout() - when we
remove non-pure dentry. It checks that directory isn't empty before,
but I'm sure that vfs_rename which exchanges dentry and whiteout
could fail for some reason and we'll end with unhashed dentry when
nothing actually has been changed.

> ---
>  fs/overlayfs/dir.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
> index 692ceda..36d6a5b 100644
> --- a/fs/overlayfs/dir.c
> +++ b/fs/overlayfs/dir.c
> @@ -618,7 +618,8 @@ static int ovl_remove_upper(struct dentry *dentry, bool is_dir)
>          * sole user of this dentry.  Too tricky...  Just unhash for
>          * now.
>          */
> -       d_drop(dentry);
> +       if (!err)
> +               d_drop(dentry);
>         mutex_unlock(&dir->i_mutex);
>
>         return err;
> --
> 1.7.5.4
>

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


Thread

Re: [PATCH] ovl: fix getcwd() failure after unsuccessful rmdir Konstantin Khlebnikov <koct9i@gmail.com> - 2016-01-30 10:50 +0100

csiph-web