Commit bac1b8d
Ming Lei
loop: fix backing file reference leak on validation error
JIRA: https://issues.redhat.com/browse/RHEL-118049
commit 98b7bf5
Author: Li Chen <me@linux.beauty>
Date: Tue Sep 30 08:35:59 2025 +0800
loop: fix backing file reference leak on validation error
loop_change_fd() and loop_configure() call loop_check_backing_file()
to validate the new backing file. If validation fails, the reference
acquired by fget() was not dropped, leaking a file reference.
Fix this by calling fput(file) before returning the error.
Cc: stable@vger.kernel.org
Cc: Markus Elfring <Markus.Elfring@web.de>
CC: Yang Erkun <yangerkun@huawei.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Yu Kuai <yukuai1@huaweicloud.com>
Fixes: f5c84ef ("loop: Add sanity check for read/write_iter")
Signed-off-by: Li Chen <chenl311@chinatelecom.cn>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Yang Erkun <yangerkun@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ming Lei <ming.lei@redhat.com>1 parent 14c3cf9 commit bac1b8d
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
541 | 541 | | |
542 | 542 | | |
543 | 543 | | |
544 | | - | |
| 544 | + | |
| 545 | + | |
545 | 546 | | |
| 547 | + | |
546 | 548 | | |
547 | 549 | | |
548 | 550 | | |
| |||
983 | 985 | | |
984 | 986 | | |
985 | 987 | | |
986 | | - | |
| 988 | + | |
| 989 | + | |
987 | 990 | | |
| 991 | + | |
988 | 992 | | |
989 | 993 | | |
990 | 994 | | |
| |||
0 commit comments