[PATCH v2 1/1] eventfd: check ida_simple_get() return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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

diff --git a/fs/eventfd.c b/fs/eventfd.c
index c0ffee99ad23..208474d49ea4 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -428,6 +428,10 @@ 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) {
+		fd = ctx->id;
+		goto err;
+	}
 
 	flags &= EFD_SHARED_FCNTL_FLAGS;
 	flags |= O_RDWR;
-- 
2.27.0




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux