]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ovl: fix file leak in ovl_real_fdget_meta()
authorAmir Goldstein <amir73il@gmail.com>
Fri, 27 Sep 2024 11:54:23 +0000 (13:54 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 27 Sep 2024 19:38:47 +0000 (12:38 -0700)
ovl_open_realfile() is wrongly called twice after conversion to
new struct fd.

Fixes: 88a2f6468d01 ("struct fd: representation change")
Reported-by: syzbot+d9efec94dcbfa0de1c07@syzkaller.appspotmail.com
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/overlayfs/file.c

index 2b7a5a3a7a2fed1bedea6173a101045b04e83a2a..4504493b20beda381683c1485a8bcaac0ab7da7f 100644 (file)
@@ -117,7 +117,7 @@ static int ovl_real_fdget_meta(const struct file *file, struct fd *real,
                struct file *f = ovl_open_realfile(file, &realpath);
                if (IS_ERR(f))
                        return PTR_ERR(f);
-               real->word = (unsigned long)ovl_open_realfile(file, &realpath) | FDPUT_FPUT;
+               real->word = (unsigned long)f | FDPUT_FPUT;
                return 0;
        }