From mboxrd@z Thu Jan 1 00:00:00 1970 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 93D641459EA; Mon, 24 Feb 2025 14:53:49 +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=1740408829; cv=none; b=WqmdhSYc9vshIVIf2wGHBPwJ4E/i7GSIdcbakdl1FhIe06zCC162TUAYUj3T+C6wDXHClVKa3hCcZiP1Gx0l8wfJsV/Uy3ibchXScIR9/UpEUpnHHoq7Qt7TAVs8S6ylNZrrlOYO3au+XkqeGy+FqGPrV4rLW9R7RJfx+7AgQ20= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740408829; c=relaxed/simple; bh=Mdl10YjekZ65da15eMumOToQeyYDvx4gvqgQbGiGq1Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HKbY909wUeetM2viZortAseghze5Q1BS9Ipq479XxypOSb63jzFW+f/bkcqM7ajo5AjZ7EWmBVlK2nKA32wh0OoV5Vctu3RI9sbv98rlLfjTXcynCkVnUcGey8ltrE3rLobgiP5jk3iLHXsNS15dzJJumCSDj+CP27qz3DpSNqs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZU+y1MkC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ZU+y1MkC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFD58C4CED6; Mon, 24 Feb 2025 14:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740408829; bh=Mdl10YjekZ65da15eMumOToQeyYDvx4gvqgQbGiGq1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZU+y1MkCUDsdHlYZmGNDpNl2p2xw134WHGr+pNSryUA6VcCYW8LmvRyxaEIA5WnL2 t9Lqzl8oSULiKyjymO+wvyyxigloRYeZuHm8AN7pOoGw77QP1elV6IedvYOKnf6Rt5 1pUlfW0aun7aA/+3LjGuFqwILk448VT0qvNEBjhw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mathieu Desnoyers , Vincent Donnefort , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Sasha Levin Subject: [PATCH 6.13 018/138] tracing: Have the error of __tracing_resize_ring_buffer() passed to user Date: Mon, 24 Feb 2025 15:34:08 +0100 Message-ID: <20250224142605.182499731@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224142604.442289573@linuxfoundation.org> References: <20250224142604.442289573@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steven Rostedt [ Upstream commit 60b8f711143de7cd9c0f55be0fe7eb94b19eb5c7 ] Currently if __tracing_resize_ring_buffer() returns an error, the tracing_resize_ringbuffer() returns -ENOMEM. But it may not be a memory issue that caused the function to fail. If the ring buffer is memory mapped, then the resizing of the ring buffer will be disabled. But if the user tries to resize the buffer, it will get an -ENOMEM returned, which is confusing because there is plenty of memory. The actual error returned was -EBUSY, which would make much more sense to the user. Cc: stable@vger.kernel.org Cc: Mathieu Desnoyers Cc: Vincent Donnefort Link: https://lore.kernel.org/20250213134132.7e4505d7@gandalf.local.home Fixes: 117c39200d9d7 ("ring-buffer: Introducing ring-buffer mapping functions") Signed-off-by: Steven Rostedt (Google) Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Sasha Levin --- kernel/trace/trace.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 69aaa8ed7a047..14179a1ee9cca 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -5975,8 +5975,6 @@ static int __tracing_resize_ring_buffer(struct trace_array *tr, ssize_t tracing_resize_ring_buffer(struct trace_array *tr, unsigned long size, int cpu_id) { - int ret; - guard(mutex)(&trace_types_lock); if (cpu_id != RING_BUFFER_ALL_CPUS) { @@ -5985,11 +5983,7 @@ ssize_t tracing_resize_ring_buffer(struct trace_array *tr, return -EINVAL; } - ret = __tracing_resize_ring_buffer(tr, size, cpu_id); - if (ret < 0) - ret = -ENOMEM; - - return ret; + return __tracing_resize_ring_buffer(tr, size, cpu_id); } static void update_last_data(struct trace_array *tr) -- 2.39.5