linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ovl: fix fd leak in ovl_flush()
@ 2021-01-26 16:51 Amir Goldstein
  2021-01-27  5:42 ` Sargun Dhillon
  2021-01-28  9:24 ` Miklos Szeredi
  0 siblings, 2 replies; 3+ messages in thread
From: Amir Goldstein @ 2021-01-26 16:51 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-unionfs

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ovl: fix fd leak in ovl_flush()
  2021-01-26 16:51 [PATCH] ovl: fix fd leak in ovl_flush() Amir Goldstein
@ 2021-01-27  5:42 ` Sargun Dhillon
  2021-01-28  9:24 ` Miklos Szeredi
  1 sibling, 0 replies; 3+ messages in thread
From: Sargun Dhillon @ 2021-01-27  5:42 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: Miklos Szeredi, overlayfs

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ovl: fix fd leak in ovl_flush()
  2021-01-26 16:51 [PATCH] ovl: fix fd leak in ovl_flush() Amir Goldstein
  2021-01-27  5:42 ` Sargun Dhillon
@ 2021-01-28  9:24 ` Miklos Szeredi
  1 sibling, 0 replies; 3+ messages in thread
From: Miklos Szeredi @ 2021-01-28  9:24 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: overlayfs

On Tue, Jan 26, 2021 at 5:51 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, folded and pushed out.

Miklos

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-28  9:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26 16:51 [PATCH] ovl: fix fd leak in ovl_flush() Amir Goldstein
2021-01-27  5:42 ` Sargun Dhillon
2021-01-28  9:24 ` Miklos Szeredi

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).