($INBOX_DIR/description missing)
 help / color / 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	[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, back to index

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

($INBOX_DIR/description missing)

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-unionfs/0 linux-unionfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-unionfs linux-unionfs/ https://lore.kernel.org/linux-unionfs \
		linux-unionfs@vger.kernel.org
	public-inbox-index linux-unionfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-unionfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git