]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ring-buffer: Clean ring_buffer_poll_wait() error return
authorVincent Donnefort <vdonnefort@google.com>
Wed, 31 Jan 2024 14:09:55 +0000 (14:09 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 08:51:47 +0000 (09:51 +0100)
commitf385565bd76b581a83b62a5b6f88ea6f149f8b83
tree48f5aba636ed6f522dc2482c65579ecd2fbebbb4
parent0e8875de9dad12805ff66e92cd5edea6a421f1cd
ring-buffer: Clean ring_buffer_poll_wait() error return

commit 66bbea9ed6446b8471d365a22734dc00556c4785 upstream.

The return type for ring_buffer_poll_wait() is __poll_t. This is behind
the scenes an unsigned where we can set event bits. In case of a
non-allocated CPU, we do return instead -EINVAL (0xffffffea). Lucky us,
this ends up setting few error bits (EPOLLERR | EPOLLHUP | EPOLLNVAL), so
user-space at least is aware something went wrong.

Nonetheless, this is an incorrect code. Replace that -EINVAL with a
proper EPOLLERR to clean that output. As this doesn't change the
behaviour, there's no need to treat this change as a bug fix.

Link: https://lore.kernel.org/linux-trace-kernel/20240131140955.3322792-1-vdonnefort@google.com
Cc: stable@vger.kernel.org
Fixes: 6721cb6002262 ("ring-buffer: Do not poll non allocated cpu buffers")
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/ring_buffer.c