diff options
| author | David Disseldorp <ddiss@suse.de> | 2023-03-07 16:21:06 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-17 08:48:59 +0100 |
| commit | b43cb0f087676db71a7baf3bec65b6439353b10d (patch) | |
| tree | 662b4f7dbc1dc10ef21a7ef0e354bbd87f64c712 | |
| parent | d15c9ae1c6d9940a7e5d5daaa25c88104ea9a595 (diff) | |
| download | linux-b43cb0f087676db71a7baf3bec65b6439353b10d.tar.gz linux-b43cb0f087676db71a7baf3bec65b6439353b10d.tar.bz2 linux-b43cb0f087676db71a7baf3bec65b6439353b10d.zip | |
watch_queue: fix IOC_WATCH_QUEUE_SET_SIZE alloc error paths
[ Upstream commit 03e1d60e177eedbd302b77af4ea5e21b5a7ade31 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | kernel/watch_queue.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c index 1059ef6c3711..54cbaa971139 100644 --- a/kernel/watch_queue.c +++ b/kernel/watch_queue.c @@ -274,6 +274,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; |
