mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [STABLE v5.15.y 1/8] file: add fput() cleanup helper
@ 2026-09-08  8:50 Lee Jones
  2026-09-08  8:50 ` [STABLE v5.15.y 2/8] eventpoll: use hlist_is_singular_node() in __ep_remove() Lee Jones
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Lee Jones @ 2026-09-08  8:50 UTC (permalink / raw)
  To: lee, Alexander Viro, Greg Kroah-Hartman, Christian Brauner,
	Wentao Guan, Josef Bacik, Jeff Layton, Peter Zijlstra,
	Paolo Abeni, Andrew Morton, Soheil Hassas Yeganeh,
	Davidlohr Bueso, Eric Dumazet, linux-fsdevel, linux-kernel
  Cc: stable

From: Christian Brauner <brauner@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@toxicpanda.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ac275934626a85285cca43405e876566daa10533)
Signed-off-by: Lee Jones <lee@kernel.org>
---
 include/linux/file.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/file.h b/include/linux/file.h
index 6726240b9279..fb8a5d22531e 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;
 
@@ -95,6 +96,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);
 
-- 
2.55.0.979.g7e5102b832-goog


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-09-08 22:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08  8:50 [STABLE v5.15.y 1/8] file: add fput() cleanup helper Lee Jones
2026-09-08  8:50 ` [STABLE v5.15.y 2/8] eventpoll: use hlist_is_singular_node() in __ep_remove() Lee Jones
2026-09-08  8:50 ` [STABLE v5.15.y 3/8] eventpoll: split __ep_remove() Lee Jones
2026-09-08  8:51 ` [STABLE v5.15.y 4/8] eventpoll: kill __ep_remove() Lee Jones
2026-09-08 22:39   ` Sasha Levin
2026-09-08  8:51 ` [STABLE v5.15.y 5/8] eventpoll: drop vestigial __ prefix from ep_remove_{file,epi}() Lee Jones
2026-09-08  8:51 ` [STABLE v5.15.y 6/8] eventpoll: rename ep_remove_safe() back to ep_remove() Lee Jones
2026-09-08  8:51 ` [STABLE v5.15.y 7/8] eventpoll: move epi_fget() up Lee Jones
2026-09-08  8:51 ` [STABLE v5.15.y 8/8] eventpoll: fix ep_remove struct eventpoll / struct file UAF Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®