linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: youngjun <her0gyugyu@gmail.com>
Cc: overlayfs <linux-unionfs@vger.kernel.org>,
	stable <stable@vger.kernel.org>
Subject: Re: [PATCH v3] ovl: inode reference leak in ovl_is_inuse true case.
Date: Tue, 16 Jun 2020 10:11:00 +0300	[thread overview]
Message-ID: <CAOQ4uxh47beMet1QO+uT6TdYHJVBJDpOr4G+_0stUMYtURymuQ@mail.gmail.com> (raw)
In-Reply-To: <20200616065756.20140-1-her0gyugyu@gmail.com>

On Tue, Jun 16, 2020 at 9:58 AM youngjun <her0gyugyu@gmail.com> wrote:
>
> When "ovl_is_inuse" true case, trap inode reference not put.
> plus adding the comment explaining sequence of
> ovl_is_inuse after ovl_setup_trap.
>
> Fixes: 0be0bfd2de9d ("ovl: fix regression caused by overlapping layers..")
> Cc: <stable@vger.kernel.org> # v4.19+
> Reviewed-by: Amir Goldstein <amir73il@gmail.com>
> > Signed-off-by: youngjun <her0gyugyu@gmail.com>
> > ---
> >  fs/overlayfs/super.c | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> > index 91476bc422f9..0396793dadb8 100644
> > --- a/fs/overlayfs/super.c
> > +++ b/fs/overlayfs/super.c
> > @@ -1029,6 +1029,12 @@ static const struct xattr_handler *ovl_xattr_handlers[] = {
> >         NULL
> >  };
> >
> > +/*
> > + * Check if lower root conflicts with this overlay layers before checking
> > + * if it is in-use as upperdir/workdir of "another" mount, because we do
> > + * not bother to check in ovl_is_inuse() if the upperdir/workdir is in fact
> > + * in-use by our upperdir/workdir.
> > + */
>
> Signed-off-by: youngjun <her0gyugyu@gmail.com>
> ---
>  fs/overlayfs/super.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> index 91476bc422f9..3097142b1e23 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -1493,14 +1493,22 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs,
>                 if (err < 0)
>                         goto out;
>
> +               /*
> +                * Check if lower root conflicts with this overlay layers before checking
> +                * if it is in-use as upperdir/workdir of "another" mount, because we do
> +                * not bother to check in ovl_is_inuse() if the upperdir/workdir is in fact
> +                * in-use by our upperdir/workdir.
> +                */
>                 err = ovl_setup_trap(sb, stack[i].dentry, &trap, "lowerdir");
>                 if (err)
>                         goto out;
>
>                 if (ovl_is_inuse(stack[i].dentry)) {
>                         err = ovl_report_in_use(ofs, "lowerdir");
> -                       if (err)
> +                       if (err) {
> +                               iput(trap);
>                                 goto out;
> +                       }
>                 }
>
>                 mnt = clone_private_mount(&stack[i]);
> --
> 2.17.1
>
> Great thanks Amir. guidance to me really helpful.
> As you comment, I modified my patch.
>
> 1) I revised three patch so version is 3.

Thanks good, but you should not reply to v2, you should post
a clean new patch, with revised commit message and change.

> 2) I misunderstood your comment(adding annotation) firstly.
> But, I clearly know at now and modified it.
> the annotation before "ovl_setup_trap" is clearly understood as I see.
>
> And I have some questions.
>
> 1) As I understand, The CC you said valid is 'linux-unionfs'?

Yes.
And as I understand there is no need actually CC the patch to
stable <stable@vger.kernel.org>, the text in commit message
is enough for their tools to pickup the patch  whenever it
gets merged.

> 2) The comment "Please add these lines to the bottom of commit message..."
>    Is it needed manually when I revised patch?

Yes, these lines are supposed to be there in the final merged commit.
Maintainers can add them, but it's nice to make life easier for busy
maintainers and add those line when you re-post the patch,
so the maintainer doesn't need to look it back in emails.

Thanks,
Amir.

  reply	other threads:[~2020-06-16  7:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 15:56 [PATCH] ovl: inode reference leak in "ovl_is_inuse" true case youngjun
2020-06-15 16:45 ` Amir Goldstein
2020-06-16  4:46 ` [PATCH] ovl: inode reference leak in ovl_is_inuse " youngjun
2020-06-16  5:33   ` Amir Goldstein
2020-06-16  6:57 ` [PATCH v3] " youngjun
2020-06-16  7:11   ` Amir Goldstein [this message]
2020-06-16  8:30 ` [PATCH 4/4] " youngjun
2020-07-14 14:40   ` Miklos Szeredi
2020-06-16  8:33 ` [PATCH v4] " youngjun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOQ4uxh47beMet1QO+uT6TdYHJVBJDpOr4G+_0stUMYtURymuQ@mail.gmail.com \
    --to=amir73il@gmail.com \
    --cc=her0gyugyu@gmail.com \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).