Re: [PATCH] loop: fix backing file reference leak on validation error

From: Li Chen

Date: Mon Sep 29 2025 - 08:53:48 EST


Hi Markus,

---- On Sun, 28 Sep 2025 21:48:23 +0800 Markus Elfring <Markus.Elfring@xxxxxx> wrote ---
>
> > Fix this by calling fput(file) before returning the error.
>
> > +++ b/drivers/block/loop.c
>
>
> How do you think about to increase the application of scope-based resource management?
> https://elixir.bootlin.com/linux/v6.17-rc7/source/include/linux/file.h#L97

Looks good; I will add a commit to switch to scope-based resource management in v2.
Thanks for your suggestion!

Regards,
Li