From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 68503C00140 for ; Wed, 24 Aug 2022 09:43:23 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AF5D4844; Wed, 24 Aug 2022 11:42:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AF5D4844 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1661334200; bh=LnJ+sYaAQ4faiNAorfvoQeQL+OF2n2y3GNCvS/0qfBk=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Q2yOCBS+eiVm8P0rP7utsMB9cym3c+IDLEQgpFSYthQeS1PvS+L4zeShxugxaa5LG uBvCt4kYLJuZKv3EOiIkxumjs3BPpDVCyYb+7omHwA/5zbl6AYh+8CyX8fzs2eQ0mi +Pg+TJSGMq1JsKKWyz4ToE18BIOpnD9tiFLbLLJY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3D455F8014E; Wed, 24 Aug 2022 11:42:30 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EB48BF804BD; Wed, 24 Aug 2022 11:42:28 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 943A1F800C8 for ; Wed, 24 Aug 2022 11:42:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 943A1F800C8 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="c4eX8iwj"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="2buHS59w" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D5A9C202C6; Wed, 24 Aug 2022 09:42:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661334145; 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=k9tdDx4tevBZYu34e0FF1R86AaQXWWnuGILrZlABPYM=; b=c4eX8iwj8ypAzqBbhKzQKGdr8e015OslV4uHMG9Pk6kAOZ8HsHjcDO4gLgIlty73r6DCnz fBUbMl7K0BK4+bYMD9Bi+d06O6ay/aN2zmPIQ8m8AbEZe+y2fqJHouR/WP9rYVFCx2xOAz yaEuyLHp8ibeGaID4Eun2ireQhVL9nU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661334145; 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=k9tdDx4tevBZYu34e0FF1R86AaQXWWnuGILrZlABPYM=; b=2buHS59whnuzB1XJFK0qUyOj8cXsoShBx1M1LXR1oVtf8qiQDKT4BxJIMlgEA4UcFsg4KS CJRiHNg2pzdjmrBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B210B13AC0; Wed, 24 Aug 2022 09:42:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 52zsKoHyBWMkCAAAMHmgww (envelope-from ); Wed, 24 Aug 2022 09:42:25 +0000 Date: Wed, 24 Aug 2022 11:42:25 +0200 Message-ID: <87ilmirn9a.wl-tiwai@suse.de> From: Takashi Iwai To: Zheyu Ma Subject: Re: [PATCH] ALSA: control: Fix an out-of-bounds bug in get_ctl_id_hash() In-Reply-To: <20220824081654.3767739-1-zheyuma97@gmail.com> References: <20220824081654.3767739-1-zheyuma97@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Takashi Iwai X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Wed, 24 Aug 2022 10:16:54 +0200, Zheyu Ma wrote: > > Since the user can control the arguments provided to the kernel by the > ioctl() system call, an out-of-bounds bug occurs when the 'id->name' > provided by the user does not end with '\0'. > > The following log can reveal it: > > [ 10.002313] BUG: KASAN: stack-out-of-bounds in snd_ctl_find_id+0x36c/0x3a0 > [ 10.002895] Read of size 1 at addr ffff888109f5fe28 by task snd/439 > [ 10.004934] Call Trace: > [ 10.007140] snd_ctl_find_id+0x36c/0x3a0 > [ 10.007489] snd_ctl_ioctl+0x6cf/0x10e0 > > Fix this by checking the bound of 'id->name' in the loop. > > Fixes: c27e1efb61c5 ("ALSA: control: Use xarray for faster lookups") > Signed-off-by: Zheyu Ma Thanks, applied now. Takashi