From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5ACD5496D3C; Thu, 8 Oct 2026 10:42:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791456165; cv=none; b=VCdeLyLxvnX17kUGp7i3Qgij7Ky1eKCIUr44yL+5v5Mqz/NfT5aLkKvVrfffVB/BK6K1b1Y/0revtyEid29d0gf0KR4oYjQ5hBU63eWUiD64m2bXXMv3OnILd6gilMfNyYTubOZESclM4Safi3AfG6dxN8xQ05g6yYWhRb029Q8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791456165; c=relaxed/simple; bh=39SrvaI7/82e7s2rDO40gk0C1iYskPBYRvi77tf+9mE=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=FLywz63N56+H5/t+Lv0RoTPUyt6BuBHieWUkeSfVmbOt01jpiHOoqX6fLnD2PcmGwSQ11fWxXmQYYIcIGDw6XPZ6UqfOUr7pOW2VAFYi/xLkMrm4xcKNcOmpN/oTGNpeDSBNkEXFodw/RE3EJTawzLD8q07jG+ODaUwrt5Zhq2o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=eQAEu+wA; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=u09tstiM; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="eQAEu+wA"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="u09tstiM" Received: from imap1.dmz-prg2.suse.org (unknown [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-out2.suse.de (Postfix) with ESMTPS id 4CECB1F441; Thu, 8 Oct 2026 10:42:41 +0000 (UTC) Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1791456161; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5H0A15BWA9z4+ePubsb9p/19M0gWf69//mOEXS4aRuo=; b=eQAEu+wA7b9Pk9Fx38ExfVWOnz+zSuWpgDC19ER7b3bLj3BWeJu/t0g9mdRYODoFoGcT8f GnexeC+0uHeLQbX5ICWZlnqtLBoY4u+qJ+QVv3wMr9AH534elV+8r9ZiUqPez/t8xa2ZVb DB3Gv4KHPJBnCVKyYPdkw0nLYA75POI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1791456161; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5H0A15BWA9z4+ePubsb9p/19M0gWf69//mOEXS4aRuo=; b=u09tstiMALECz0SvO65zGN30fBK7ufxwy6H78oNkk9sQ5YRMyu/FBDaudJz7G9N6h8ne8b rhS4Foitg5+Zk3AA== 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 249841339F; Thu, 8 Oct 2026 10:42:41 +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 YW3bOqBzx2q2TwAAD6G6ig (envelope-from ); Thu, 08 Oct 2026 10:42:41 +0000 Date: Thu, 08 Oct 2026 12:42:32 +0200 Message-ID: <87fqyg5v8n.wl-tiwai@suse.de> From: Takashi Iwai To: Peter Ujfalusi Cc: perex@perex.cz, tiwai@suse.com, linux-sound@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] ALSA: x86: hdmi: fix chmap array missing terminator entry In-Reply-To: <20261008085411.13742-1-peter.ujfalusi@linux.intel.com> References: <20261008085411.13742-1-peter.ujfalusi@linux.intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/30.2 Mule/6.0 Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spamd-Result: default: False [0.00 / 50.00] X-Spam-Score: 0.00 X-Spam-Flag: NO X-Spam-Level: X-Rspamd-Pre-Result: action=no action; module=Unknown lua; unknown reason On Thu, 08 Oct 2026 10:54:11 +0200, Peter Ujfalusi wrote: > > had_build_channel_allocation_map() allocates a single struct > snd_pcm_chmap_elem via kzalloc() and stores it as > intelhaddata->chmap->chmap. struct snd_pcm_chmap.chmap is expected to > be a zero-terminated array (see snd_pcm_std_chmaps[]), but > had_register_chmap_ctls() never overrides the TLV callback installed > by snd_pcm_add_chmap_ctls(), so the generic pcm_chmap_ctl_tlv() from > ALSA core is left in place. > > pcm_chmap_ctl_tlv() is reachable by any local user via > SNDRV_CTL_IOCTL_TLV_READ on the "Playback Channel Map" control and > walks the array with "for (map = info->chmap; map->channels; map++)". > Since the driver's single element is never terminated, this walks > past the allocation. The same pointer is also freed on hot-unplug and > rebuilt on hot-plug under intelhaddata->mutex, while the TLV callback > runs under card->controls_rwsem without that mutex, so the walk can > also race a concurrent free of the array. > > Fix this by allocating a second, zeroed element so the array is > properly terminated, and by dropping the inherited TLV callback > entirely at registration time, since the driver never implements one > of its own. > > Fixes: 5dab11d89777 ("ALSA: x86: hdmi: Add audio support for BYT and CHT") > Cc: stable@vger.kernel.org > Signed-off-by: Peter Ujfalusi Applied to for-next branch. Thanks. Takashi