diff --git a/fs/eventfd.c b/fs/eventfd.c index 3627dd7d25db80..da24bf8dd2ca37 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c @@ -424,6 +424,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;