From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E377606A81C for ; Tue, 3 Nov 2026 10:41:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=RabjqJ3U DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=n3928gBIWqHxVcE0Q0TQTSHKUQ5+JmJrD1oVco54lEw=; b=RabjqJ3UDxzcquT+bIGbNMO1Yj dFkxO96pe91ywtX4Lcf3uzgyyE3V3D9dqyE7Uh3eQFv2YHqvAxQR615FS87YlVU7i/lbw43wV51Cn eHHHe7NYYELJlABLXEW/mj0d2MKU6IyHgg04JrkJMxrewznja4FNRbJswID7EjiTzQ41VuBriF2zO h93sZS2VkaeYWhZe+EySw3VT+7qzhGyG8Kfne7J0R2fAHA/FvhMnVu2/FLlFdGT5l295GG0OBt/vM Dr/X9k424LlOLns65bdfTlgz/bG0YZVb/ULXhXSSmDTwjbczBFdgCukwsYXvV/9/mb58kOd0paYbb rIjP8utw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xOBxM-000000022xP-2XAw; Tue, 03 Nov 2026 10:41:32 +0000 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xOBxF-000000022pp-1gei; Tue, 03 Nov 2026 10:41:30 +0000 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8017122D12; Tue, 3 Nov 2026 10:41:18 +0000 (UTC) Authentication-Results: smtp-out1.suse.de; none Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A98D41350A; Tue, 3 Nov 2026 10:41:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id fPJkIE266WqxEgAAD6G6ig (envelope-from ); Tue, 03 Nov 2026 10:41:17 +0000 Date: Tue, 03 Nov 2026 11:41:09 +0100 Message-ID: <87ik2exkmy.wl-tiwai@suse.de> From: Takashi Iwai To: Christian Brauner Cc: linux-fsdevel@vger.kernel.org, Linus Torvalds , Jann Horn , Josef Bacik , Chris Mason , Jeff Layton , NeilBrown , Eric Dumazet , Thomas Gleixner , Al Viro , Jonathan Corbet , Christoph Hellwig , Greg Kroah-Hartman , Joel Granados , Kees Cook , Jan Kara , Jan Kara , 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 , 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, Chuck Lever , stable@vger.kernel.org Subject: Re: [PATCH RFC 09/38] ALSA: info: don't write past the end of a data entry In-Reply-To: <20261102-work-procfs-bugfixes-v1-9-59422ed3e465@kernel.org> References: <20261102-work-procfs-bugfixes-v1-0-59422ed3e465@kernel.org> <20261102-work-procfs-bugfixes-v1-9-59422ed3e465@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/30.2 Mule/6.0 X-Archived-By: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Score: -4.00 X-Spam-Level: X-Rspamd-Queue-Id: 8017122D12 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261103_024126_479892_99742002 X-CRM114-Status: GOOD ( 22.95 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Mon, 02 Nov 2026 15:21:24 +0100, Christian Brauner wrote: > > 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") > Cc: stable@vger.kernel.org > Signed-off-by: Christian Brauner (Amutable) Reviewed-by: Takashi Iwai thanks, Takashi > --- > sound/core/info.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/sound/core/info.c b/sound/core/info.c > index c4d57d0809ad..982087bc8575 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 >