watch_queue: fix IOC_WATCH_QUEUE_SET_SIZE alloc error paths
authorDavid Disseldorp <ddiss@suse.de>
Tue, 7 Mar 2023 15:21:06 +0000 (16:21 +0100)
committerChristian Brauner (Microsoft) <brauner@kernel.org>
Wed, 8 Mar 2023 10:44:45 +0000 (11:44 +0100)
commit03e1d60e177eedbd302b77af4ea5e21b5a7ade31
tree3626114a1dadb3925cd24a5c722d073d59a68bd1
parentfe15c26ee26efa11741a7b632e9f23b01aca4cc6
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>
kernel/watch_queue.c