Article View: linux.kernel.netdev
Article #11177[PATCH RESEND v2 22/51] ALSA: info: don't write past the end of a data entry
From: Christian Brauner
Date: Wed, 04 Nov 2026 19:21
Date: Wed, 04 Nov 2026 19:21
34 lines
11366 bytes
11366 bytes
snd_info_entry_write() clamps the count to what is left of the entry
by computing entry->size - pos as a size_t. For a position past the end
that wraps and the write goes to the driver unclamped, for opl4 into
sample memory outside of what the entry covers. At the end of the entry
the driver gets a count of 0 and vmalloc(0) warns. Before the clamp
moved into the common code the driver ignored such writes. Fail them
with -ENOSPC instead, like a block device does at the end of the
device. Returning 0 would make writers that use stdio retry forever.
Fixes: d97e1b78239c ("ALSA: info - Check file position validity in common layer")
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
sound/core/info.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/core/info.c b/sound/core/info.c
index 023b4736aa6d..f608d335b6c9 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -171,6 +171,8 @@ static ssize_t snd_info_entry_write(struct file *file, const char __user *buffer
pos = *offset;
if (!valid_pos(pos, count))
return -EIO;
+ if (pos >= entry->size)
+ return count ? -ENOSPC : 0;
if (count > 0) {
size_t maxsize = entry->size - pos;
count = min(count, maxsize);
--
2.53.0
Technical Details
Message-ID:
<20261104-work-procfs-bugfixes-v2-22-021c84d852e0@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356747-linux-kernel-netdev=dewy.ruReferences:
<20261104-work-procfs-bugfixes-v2-0-021c84d852e0@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356747-linux-kernel-netdev=dewy.ru From: brauner@kernel.org (Christian Brauner) Newsgroups: linux.kernel.netdev Subject: [PATCH RESEND v2 22/51] ALSA: info: don't write past the end of a data entry Date: Wed, 4 Nov 2026 20:21:20 +0100 Organization: Usenet Network Message-ID: <20261104-work-procfs-bugfixes-v2-22-021c84d852e0@kernel.org> References: <20261104-work-procfs-bugfixes-v2-0-021c84d852e0@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3467856"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:EFUfdRltvqcgK2xH0C1DojInwwc= sha256:Gmt/NJ6D0UGDCiDF5mwgcZYmLccYG6Xj4+7CcGZMzpU= sha1:korz6ceZlUkXZEfEzyPZnLNXDdI= sha256:kXIiHCaN2TifEFHyJaLmuYtjaIZpKMbImnznZqA+9Ic= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 6991B112D0C; Wed, 4 Nov 2026 22:35:43 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.401 X-Spam-Status: No, score=-2.401 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CfsyvxahXaaf; Wed, 4 Nov 2026 22:35:40 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-356747-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 7D6BC112CEE; Wed, 4 Nov 2026 22:35:31 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 0038960E701; Wed, 4 Nov 2026 19:30:11 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793820131; b=G7XddGfQekw2iphLHS5kBnppKnP2rhuTKwdH/ycEMIoM6+9SoN5VS0xt1eamuNtxwt+V y3QI7jra/JXq+MO8lGwEJLt5KOdmQ3beG9mBcJpGVcTBxd9KSAnZymJ5LX6Do+ujUCVtc R/W8ystcMhbtA/AK/Vdm2aSEXf474ELiDgMPV6dDmzDHklsokblcGjTAslRBDeQ+JhAyr 41BwWK1xHd3sXQUTT3iiADhbdrnCRx4daoxYKCS8O3MFFNCAN29YX+kWsvqeCe/E38X+l iX8YtIl77me4yKcoEmWPmhKGg/oxyYHGWLu/XBaJxdTOWzTxe58OtbbF/deCEbea+IA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793820131; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:In-Reply-To:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:X-Mailer:X-Developer-Signature: X-Developer-Key:Content-Transfer-Encoding; bh=ih8EKkL3fEFrmnOibnSg6zuDA24U9CpFmMUb1+ThTQI=; b=uvjJfEYEy1U5lI100wiHd5LMmxf5iPYDCUpmynH/hXU/9zGZ6Ce8wJ5ES4vvfFjdgkoR 5YmxpxXqJ0722OVSTtZx9apRipsXiaAExtRVD+DnbwvAsfopXhJg6hE+OVfuZrVfsECSN /MSAuUkUVEKJW/JHQ3aAhaqIC/y1Oa60v4lbU9OEDdjYbcsbmX4bAX3aULNoAIKJXM4ak V0j84PmaUQSoy1VuD7pU7eq4J0ogCS1Vhs9tx9ckl64Xu2hS2tnZU64A2BQyQQsvXGkxc 0NN091StutABD4+O7TLgloBy4SOoqbs363/oa6PmPjs4VVn5QbxqH0i3Q+IXdLvpISA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="NV/pCHTx"; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B27F76076CC9; Wed, 4 Nov 2026 19:22:11 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NV/pCHTx X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793820095; b=PpGNl2JQ+Iyn+xRsPkOFwNGQKgZifn2VdMDrh2lzlqAcBVLJStjcibvYaKVabTOlA0be 4ODPnhfIsS8bRz17dD3M3IfREJ5sPvVCk9pnn65Mt3Z2BCYJgWRqRcmepm9WSiKILKScc hnd40fvuiOmWbTyzd7798FgqGi3gGBMAznwE/4eNlDBMIWSJIAbSmwb+l/1AaR/Iq1Bu4 PaSsjO1H8qqau96qEzOswi+0U0AYT94GQSY3mma+545hamhH8qxnZ2s36OXT6aT4CQQXf ZpBb1x2f7Z6CJpq08S0D7kqaQQyWemA4DjfMggz6XJqTZcwAsGqnHLPxO6G4UwEit7g== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793820095; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID: In-Reply-To:References:MIME-Version:Content-Type:X-Mailer: X-Developer-Signature:X-Developer-Key:Content-Transfer-Encoding; bh=ih8EKkL3fEFrmnOibnSg6zuDA24U9CpFmMUb1+ThTQI=; b=sMunYd4xJPcP/d89IArdZqMCCE30wexaTGhVntJmaxDeKe2/mTiBynXQH23cxfE7zOIr a72HO/gry9K229WLZhXaJv1tG0Bbak70k4Tx/7PqFWMvJHUrxiJ9nVhYAjWIoRI2bv8Wa SpsIuAWGfq8vBbN0d5wJGxnhL/OiWIt70CDiOX2Lk3V8boCl6uLk3csIU9DJ7KAawItCB 0GEq6c/2IQ4ppmQv3Al7b2r2dfLOXfBZYcoq/9isSLPM6bNwC8V50ENxO7B/Orflqe83Q I1MENUp140WM3v/7UXK93ESgR5BU3CC0uj2N5FNcrPggDtrcHc+Uxi9Uti2+4txNRIQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="NV/pCHTx"; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D0F0606AB3A; Wed, 4 Nov 2026 19:21:35 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEDE71F0093A; Wed, 4 Nov 2026 19:21:22 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793820095; bh=ih8EKkL3fEFrmnOibnSg6zuDA24U9CpFmMUb1+ThTQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NV/pCHTxChzVH1ioWmq+QeUT+SBXucwSnRPJOdBi/Q2y75DGHw15YBMqYjqgrtt2O VyFPPs8v7zjoqFDFOJ5oAl9YXifHpXNyabEPReJZQwa8XXH4iQGv2Qty9h/jandirD aUMSk23okxfo9KtkbC4/nzn1Iw09lddant5cO9hakE0csEjqm8lPvF90MPEOYpmUAd IMkDVpUwfqgAQLlAK9nXdyRgIdGxWTHDKSyuqOT48xWUvA/iAJk+qPbBXnzRbF0y+d wn/gLZpI4BHKSDGznFL2I2ZF9zF+c1mxFQKqQBN2chjmpu2miV52eKF6iZL2Z2lRgn AL7Cg1xDOYz2Q== X-Cc: Linus Torvalds <torvalds@linux-foundation.org>, Jann Horn <jannh@google.com>, Josef Bacik <josef@toxicpanda.com>, Chris Mason <mason@kernel.org>, Jeff Layton <jlayton@kernel.org>, NeilBrown <neil@brown.name>, Eric Dumazet <edumazet@kernel.org>, Thomas Gleixner <tglx@kernel.org>, Al Viro <viro@zeniv.linux.org.uk>, Jonathan Corbet <corbet@lwn.net>, Christoph Hellwig <hch@lst.de>, Greg Kroah-Hartman <gregkh@suse.de>, Joel Granados <joel.granados@kernel.org>, Kees Cook <kees@kernel.org>, Jan Kara <jack@suse.cz>, Jan Kara <jack@suse.com>, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, linux-um@lists.infradead.org, linux-wireless@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, ntfs3@lists.linux.dev, platform-driver-x86@vger.kernel.org, coreteam@netfilter.org, kexec@lists.infradead.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, netfilter-devel@vger.kernel.org, dri-devel@lists.freedesktop.org, ibm-acpi-devel@lists.sourceforge.net, jfs-discussion@lists.sourceforge.net, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-cifs@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linux-usb@vger.kernel.org, samba-technical@lists.samba.org, sparclinux@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-doc@vger.kernel.org, linux-serial@vger.kernel.org, linux-atm-general@lists.sourceforge.net, Takashi Iwai <tiwai@suse.de>, linux-input@vger.kernel.org, linux-raid@vger.kernel.org, linux-ext4@vger.kernel.org, linux-modules@vger.kernel.org, linux-debuggers@vger.kernel.org, "Christian Brauner (Amutable)" <brauner@kernel.org>, Chuck Lever <cel@kernel.org>, stable@vger.kernel.org X-In-Reply-To: <20261104-work-procfs-bugfixes-v2-0-021c84d852e0@kernel.org> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1329; i=brauner@kernel.org; h=from:subject:message-id; bh=/wIh+WZXKaFyyFYwMjXKmLvFs42DoCHjOzS3J0v96D0=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWS9bny2zMufh/VIknXNykPasit38Tx6t1dcVkb8Us6vt wpbDDY/7ihlYRDjYpAVU2RxaDcJl1vOU7HZKFMDZg4rE8gQBi5OAZjI8+UM/3Qne19pyPzkZ7uK 4+ps9RZDLa75iTtP5zvl3PvzK0/j/yuGf5bm066vnniBYWL95HgLE52AGfqMMk4eWldmv104x1K Fmw8A X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624