ovl: fix fd leak in ovl_flush()
Amir Goldstein
maintainerPATCH 1/1 ovl: fix fd leak in ovl_flush()
Signed-off-by Amir Goldstein <[email protected]>
---
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(-)
fs/overlayfs/file.c +6 -1
@@ -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; }
Signature · 1 line
2.25.1
Quoted 38 lines · Amir Goldstein
Signed-off-by Amir Goldstein <[email protected]>---
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(-)fs/overlayfs/file.c +6
-2@@ -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; } --
Quoted 2 lines
2.25.1
Thanks.
Reviewed-by Sargun Dhillon <[email protected]>
Miklos Szeredi
maintainerQuoted 7 lines · Amir Goldstein
Signed-off-by Amir Goldstein <[email protected]>---
Miklos,
This patch is against overlayfs-next which currently fails xfstests.
Thanks, folded and pushed out.
Miklos