Commit 913e7b4
ext4: fix fd leak in EXT4_IOC_MOVE_EXT cross-sb validation
The backport of upstream commit c143957 ("ext4: validate donor
file superblock early in EXT4_IOC_MOVE_EXT") uses a bare 'return -EXDEV'
which is safe upstream because the fd is managed via CLASS(fd) with
automatic cleanup (commit 8152f82 ("fdget(), more trivial
conversions")).
However, on 6.12.y the ioctl still uses the traditional fdget/fdput
pattern, so the bare return bypasses fdput(donor) at the mext_out label,
leaking the file reference.
Fix by setting err and using goto mext_out.
Fixes: 74796e8 ("ext4: validate donor file superblock early in EXT4_IOC_MOVE_EXT")
Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Signed-off-by: Yun Zhou <yun.zhou@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 0fdd406 commit 913e7b4
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1372 | 1372 | | |
1373 | 1373 | | |
1374 | 1374 | | |
1375 | | - | |
1376 | | - | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
1377 | 1379 | | |
1378 | 1380 | | |
1379 | 1381 | | |
| |||
0 commit comments