From nobody Tue Dec 23 14:11:32 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9786DBA48; Fri, 2 Feb 2024 02:30:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706841004; cv=none; b=YZ2mMcNnxxjcLrxVkWgdyX5mfNj7nCUpKAUvPzWSpH6n4oE7y9B4nh63+h3rkINMAmYbi9lbs5EB1kPXBA3uliIlrCFxlIDjzepR8DCiZzOJDszb5h7e+4X3KIXikjFAeYr1NF4hbxaNqZvM8ZXtUnfWm1sB92l7zUBbALrFZxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706841004; c=relaxed/simple; bh=xGDj3nGkIf9G4tPuNhBHZGlYOdiazfs12CRgZPhGO4w=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=K8xKM065BFtKVUjmY89nKWGfIRPH8CLzcWpt2UXUSnKF8xG4pxApi/xqWXp6jdonfp7fe9bekAymmFIQ/YtOv09ui98SW/5VtwOx2Ve0IoHQFTttgybGDUwufOne7KKdLJV6UHPzwUjFquhgg2aCsM33vm4X1yqfbAkW7Qu1OF8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 441DAC43394; Fri, 2 Feb 2024 02:30:04 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rVjJu-00000005k6A-0vDf; Thu, 01 Feb 2024 21:30:22 -0500 Message-ID: <20240202023022.088387401@goodmis.org> User-Agent: quilt/0.67 Date: Thu, 01 Feb 2024 21:30:00 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , stable@vger.kernel.org, Vincent Donnefort Subject: [for-linus][PATCH 01/13] ring-buffer: Clean ring_buffer_poll_wait() error return References: <20240202022959.515961549@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vincent Donnefort 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-v= donnefort@google.com Cc: stable@vger.kernel.org Fixes: 6721cb6002262 ("ring-buffer: Do not poll non allocated cpu buffers") Signed-off-by: Vincent Donnefort Signed-off-by: Steven Rostedt (Google) --- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 13aaf5e85b81..fd4bfe3ecf01 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -944,7 +944,7 @@ __poll_t ring_buffer_poll_wait(struct trace_buffer *buf= fer, int cpu, full =3D 0; } else { if (!cpumask_test_cpu(cpu, buffer->cpumask)) - return -EINVAL; + return EPOLLERR; =20 cpu_buffer =3D buffer->buffers[cpu]; work =3D &cpu_buffer->irq_work; --=20 2.43.0