From: David Disseldorp Date: Tue, 7 Mar 2023 15:21:06 +0000 (+0100) Subject: watch_queue: fix IOC_WATCH_QUEUE_SET_SIZE alloc error paths X-Git-Tag: v6.6.7~3301^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=03e1d60e177eedbd302b77af4ea5e21b5a7ade31;p=platform%2Fkernel%2Flinux-starfive.git watch_queue: fix IOC_WATCH_QUEUE_SET_SIZE alloc error paths The watch_queue_set_size() allocation error paths return the ret value set via the prior pipe_resize_ring() call, which will always be zero. As a result, IOC_WATCH_QUEUE_SET_SIZE callers such as "keyctl watch" fail to detect kernel wqueue->notes allocation failures and proceed to KEYCTL_WATCH_KEY, with any notifications subsequently lost. Fixes: c73be61cede58 ("pipe: Add general notification queue support") Signed-off-by: David Disseldorp Signed-off-by: Christian Brauner (Microsoft) --- diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c index a6f9bdd..f10f403 100644 --- a/kernel/watch_queue.c +++ b/kernel/watch_queue.c @@ -273,6 +273,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes) if (ret < 0) goto error; + ret = -ENOMEM; pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL); if (!pages) goto error;