[Devel] [PATCH vz9 v2 01/11] file: add fput() cleanup helper
Vladimir Riabchun
vladimir.riabchun at virtuozzo.com
Thu Jul 9 11:44:38 MSK 2026
On 7/8/26 15:15, Eva Kurchatova wrote:
> From: Christian Brauner <brauner at kernel.org>
>
> [ Upstream commit 257b1c2c78c25643526609dee0c15f1544eb3252 ]
>
> Add a simple helper to put a file reference.
>
> Link: https://lore.kernel.org/r/20240719-work-mount-namespace-v1-4-834113cab0d2@kernel.org
> Reviewed-by: Josef Bacik <josef at toxicpanda.com>
> Reviewed-by: Jeff Layton <jlayton at kernel.org>
> Signed-off-by: Christian Brauner <brauner at kernel.org>
> (cherry picked from commit 257b1c2c78c25643526609dee0c15f1544eb3252)
> Signed-off-by: Wentao Guan <guanwentao at uniontech.com>
> Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
>
> https://virtuozzo.atlassian.net/browse/VSTOR-137490
> Feature: fix epoll cve
> ---
> include/linux/file.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/file.h b/include/linux/file.h
> index 5f28fdb297e2..591c99afc854 100644
> --- a/include/linux/file.h
> +++ b/include/linux/file.h
> @@ -11,6 +11,7 @@
> #include <linux/posix_types.h>
> #include <linux/errno.h>
> #include <linux/cleanup.h>
> +#include <linux/err.h>
>
> struct file;
>
> @@ -97,6 +98,7 @@ extern void put_unused_fd(unsigned int fd);
>
> DEFINE_CLASS(get_unused_fd, int, if (_T >= 0) put_unused_fd(_T),
> get_unused_fd_flags(flags), unsigned flags)
> +DEFINE_FREE(fput, struct file *, if (!IS_ERR_OR_NULL(_T)) fput(_T))
>
> extern void fd_install(unsigned int fd, struct file *file);
>
The series looks good.
Reviewed-by: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>
--
Best regards, Riabchun Vladimir
Linux Kernel Developer, Virtuozzo
More information about the Devel
mailing list