From: Sargun Dhillon <sargun@sargun.me>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
overlayfs <linux-unionfs@vger.kernel.org>
Subject: Re: [PATCH] ovl: fix fd leak in ovl_flush()
Date: Tue, 26 Jan 2021 21:42:26 -0800 [thread overview]
Message-ID: <CAMp4zn8_LL313MYQ0aJRPOgpTe1NZN1+Gg0a-QW4qHZ1M62czQ@mail.gmail.com> (raw)
In-Reply-To: <20210126165102.1017787-1-amir73il@gmail.com>
On Tue, Jan 26, 2021 at 8:58 PM Amir Goldstein <amir73il@gmail.com> wrote:
>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
>
> Miklos,
>
> This patch is against overlayfs-next which currently fails xfstests.
>
> Thanks,
> Amir.
>
> fs/overlayfs/file.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
> index 2ff818d5c2c9..6fa9ac682beb 100644
> --- a/fs/overlayfs/file.c
> +++ b/fs/overlayfs/file.c
> @@ -693,12 +693,17 @@ static int ovl_flush(struct file *file, fl_owner_t id)
> int err;
>
> err = ovl_real_fdget(file, &real);
> - if (!err && real.file->f_op->flush) {
> + if (err)
> + return err;
> +
> + if (real.file->f_op->flush) {
> old_cred = ovl_override_creds(file_inode(file)->i_sb);
> err = real.file->f_op->flush(real.file, id);
> revert_creds(old_cred);
> }
>
> + fdput(real);
> +
> return err;
> }
>
> --
> 2.25.1
>
Thanks.
Reviewed-by: Sargun Dhillon <sargun@sargun.me>
next prev parent reply other threads:[~2021-01-27 6:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-26 16:51 [PATCH] ovl: fix fd leak in ovl_flush() Amir Goldstein
2021-01-27 5:42 ` Sargun Dhillon [this message]
2021-01-28 9:24 ` Miklos Szeredi
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=CAMp4zn8_LL313MYQ0aJRPOgpTe1NZN1+Gg0a-QW4qHZ1M62czQ@mail.gmail.com \
--to=sargun@sargun.me \
--cc=amir73il@gmail.com \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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).