linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] eventfd: check ida_simple_get() return value
@ 2022-09-07  2:37 Bo Liu
  2022-09-07  7:39 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Bo Liu @ 2022-09-07  2:37 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, linux-kernel, Bo Liu

As ida_simple_get() can fail, we should check the return value.

Signed-off-by: Bo Liu <liubo03@inspur.com>
---
 fs/eventfd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/eventfd.c b/fs/eventfd.c
index c0ffee99ad23..fde730492993 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -428,6 +428,8 @@ static int do_eventfd(unsigned int count, int flags)
 	ctx->count = count;
 	ctx->flags = flags;
 	ctx->id = ida_simple_get(&eventfd_ida, 0, 0, GFP_KERNEL);
+	if (ctx->id < 0)
+		goto err;
 
 	flags &= EFD_SHARED_FCNTL_FLAGS;
 	flags |= O_RDWR;
-- 
2.27.0


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

end of thread, other threads:[~2022-09-07  7:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-07  2:37 [PATCH] eventfd: check ida_simple_get() return value Bo Liu
2022-09-07  7:39 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).