From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 5B4B9476048; Tue, 21 Jul 2026 17:53:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784656401; cv=none; b=gWN4KHkwR51K+WHA83MjviTRambNFHKGjn1FJriARuY/VYMIv4vF/vy/CbHb55AOaic4O38pYGSQZBYbJnoyhh5IgQDEKShGcTLx0C0umDSZdEsQH9PEZpI6ChhZ7urHCQjYb2REVVGU4xO5+S1x6s6Ql24YUOo5WoeB9ANVnGQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784656401; c=relaxed/simple; bh=as1JsX92T8N6rDvGw8/0l2cgZdosGAp16hIMYAQieCE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u6SD/9yI0SnhJBK8EuMN5nMaaJo54xNoJfdKNyjdrcF2ztaH1NZAGxn/vxHAzQh8nnzwaAlgyxe+C3xaBU60t25W6WMr2QJe4105M83QLCF2aaiqFbWWlkVH+a/8p7thFbA4Z1L6ABTcIpXg4EbZ5txVikPLytYU/zag2H29mXE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=euTTKuUa; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="euTTKuUa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1E4F1F00A3D; Tue, 21 Jul 2026 17:53:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784656400; bh=ZfRfaPfyuqO1rbFs8BWqXYLP9bHGWERBCO6MCVXMg1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=euTTKuUaIFn/s0f+qnpHsbse8z2GMNi7qePNixZ6rOZ3D2rRWSuNzs/jDJYJq78tE hhDzgzLotWFnOgwgjBulicSswuwIPLYssEiGOhPLMbhPd+9osnGWAX9zi94afhlIr0 N7PjeQAHtAEcJfnGYK5InNkq6/BL2yWKCjRln998= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kyle Zeng , Takashi Iwai , Sasha Levin Subject: [PATCH 6.18 0371/1611] ALSA: seq: Clear variable event pointer on read Date: Tue, 21 Jul 2026 17:08:07 +0200 Message-ID: <20260721152523.521138777@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kyle Zeng [ Upstream commit 705dd6dcbc0ea87351c660c1a6443f85f1001c76 ] snd_seq_read() copies a queued variable-length event header to userspace before expanding the payload. Queued variable-length events use SNDRV_SEQ_EXT_CHAINED internally, and data.ext.ptr points at the first extension cell. The read side strips SNDRV_SEQ_EXT_* bits from data.ext.len before the copy, but it leaves data.ext.ptr untouched. A userspace sequencer client can therefore write a direct variable event to itself and read back the extension-cell kernel address from the returned header. Clear the temporary header pointer before copy_to_user(). The original queued event remains unchanged and is still passed to snd_seq_expand_var_event(), so payload expansion keeps using the internal chain. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kyle Zeng Link: https://patch.msgid.link/20260607004129.61345-1-kylebot@openai.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/seq/seq_clientmgr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 46a1ded7eb068b..b8b04fc79f489c 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -441,6 +441,7 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, memcpy(&tmpev, &cell->event, aligned_size); tmpev.data.ext.len &= ~SNDRV_SEQ_EXT_MASK; + tmpev.data.ext.ptr = NULL; if (copy_to_user(buf, &tmpev, aligned_size)) { err = -EFAULT; break; -- 2.53.0