summaryrefslogtreecommitdiffstats
path: root/kernel/watch_queue.c
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@suse.de>2023-03-07 16:21:06 +0100
committerChristian Brauner (Microsoft) <brauner@kernel.org>2023-03-08 11:44:45 +0100
commit03e1d60e177eedbd302b77af4ea5e21b5a7ade31 (patch)
tree3626114a1dadb3925cd24a5c722d073d59a68bd1 /kernel/watch_queue.c
parentfe15c26ee26efa11741a7b632e9f23b01aca4cc6 (diff)
downloadlinux-03e1d60e177eedbd302b77af4ea5e21b5a7ade31.tar.gz
linux-03e1d60e177eedbd302b77af4ea5e21b5a7ade31.tar.bz2
linux-03e1d60e177eedbd302b77af4ea5e21b5a7ade31.zip
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 <ddiss@suse.de> Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Diffstat (limited to 'kernel/watch_queue.c')
-rw-r--r--kernel/watch_queue.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
index a6f9bdd956c3..f10f403104e7 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;