Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2747873rdb; Fri, 22 Sep 2023 07:26:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEh37cTpZf9upCP+RYf1/mwUZ6VUztboVerPD7a0sx3pNCfdE77W2Al4eOgjU8hiEl/nUoi X-Received: by 2002:a17:903:11c8:b0:1c3:d07f:3a09 with SMTP id q8-20020a17090311c800b001c3d07f3a09mr9647963plh.65.1695392765120; Fri, 22 Sep 2023 07:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695392765; cv=none; d=google.com; s=arc-20160816; b=OyNqDqCM0JgODuL4KnkAuqaiLl0x/xWkFE3iJVXT5dpErqH9I03rhHu70pf9aaSQ7Y VVU9LreW5dDXPF9rf87ZIWuK3Cy5GRBvtV28ufOCeReqC3+P3R9SVULYT2nVMDeXT1OI uL1xMtlADA4NjvOmiF1xzWFFSkUB1nkhMeE987Sc8T2sH+/d5obgbqqgsVtVBTOlBIX6 NalpzhsLpPyQTGuzhWPcXwmR6bwiAGV2QqUqdneG/Ijt434qXTeeOT60MPVL+r572KdE alENDJIav1pRVXKTGllKVUDgJjpIXuORu12TaXtKq2OOmPzr2YQMrWTykJOPC9Bg4npd B8xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=ON/OW1Xy96pmmIh9iQH0EYnMmcRVxL2Vh0r7llzp9N4=; fh=YuIfD+IBl07a6SKBJKGcstnf2tC7jr5SoUeB2uRdycI=; b=htewkzPffrIzWPTIOCnKI8epvFEX0AJWEiSg+0LbTIxyruwtSyppRENvwaTNT2UuVt VSB/hefIIbtx0rbwm94ltuZ1WTKkdvhpFopP+HgBN2Fj7XbICGK+idoPhzApV3qRLRy/ 1kUfQTfjs8RxEq4GxetVbzTM7sVL1ab6PaEVggUm/JiXYJIZZPGIuf4fqh2Qo8qsdQ/g jmahEo71LcJ2galj6UqB/N2k34R9pHZae0hFG0MB0pUvW8ZCbOePYHIAh5em+U4HDtIM Efick/yqabVoZqYhxYjxuKqCy/7T71ZMLMD/KM0A57frNHE1P+GIzAFS7g0C3drMSuNC /WDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=1djs0c5X; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id p8-20020a170902e74800b001b9ea5f0feesi4356773plf.453.2023.09.22.07.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 07:26:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=1djs0c5X; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 7777C80879F7; Fri, 22 Sep 2023 01:46:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232558AbjIVIqf (ORCPT + 99 others); Fri, 22 Sep 2023 04:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231814AbjIVIqe (ORCPT ); Fri, 22 Sep 2023 04:46:34 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70D9899 for ; Fri, 22 Sep 2023 01:46:28 -0700 (PDT) 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-out1.suse.de (Postfix) with ESMTPS id 2BF53210E3; Fri, 22 Sep 2023 08:46:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1695372387; 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=ON/OW1Xy96pmmIh9iQH0EYnMmcRVxL2Vh0r7llzp9N4=; b=1djs0c5XNN+vmZspCLNGUT4Flc/lK4+Vcj60TEytUP+26IU/edjfv0m3nGGWvxhV31lHTQ f8kfFi1EJjtY1Zt/ribacgZ1BMpLJgiTbxo5GpP0oxBUPhk/rCSJ54jnVKW3urNIy++YWH VGesuWuB14dX+Sb9+AnijF9zlQVIqQU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1695372387; 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=ON/OW1Xy96pmmIh9iQH0EYnMmcRVxL2Vh0r7llzp9N4=; b=9ZxSuylrfh+nRjf+zrKiG/vQL25yb1BlSV1PqJ25EfnnsQwJXJ1ryZwSyMrJSHmdIw2B1A BxwDfhVM1C8ZdECQ== 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 EC09713597; Fri, 22 Sep 2023 08:46:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KQeyOGJUDWVjRgAAMHmgww (envelope-from ); Fri, 22 Sep 2023 08:46:26 +0000 Date: Fri, 22 Sep 2023 10:46:26 +0200 Message-ID: <87h6nmegt9.wl-tiwai@suse.de> From: Takashi Iwai To: "Ricardo B. Marliere" Cc: Jaroslav Kysela , Takashi Iwai , Ruslan Bilovol , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, syzbot+59875ffef5cb9c9b29e9@syzkaller.appspotmail.com Subject: Re: [PATCH] sound: usb: increase snd_card alloc size In-Reply-To: <20230922005152.163640-1-ricardo@marliere.net> References: <20230922005152.163640-1-ricardo@marliere.net> 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 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 22 Sep 2023 01:46:39 -0700 (PDT) On Fri, 22 Sep 2023 02:51:53 +0200, Ricardo B. Marliere wrote: > > Syzbot reports a slab-out-of-bounds read of a snd_card object. When > snd_usb_audio_create calls snd_card_new, it passes sizeof(*chip) as the > extra_size argument, which is not enough in this case. > > Relevant logs below: > > BUG: KASAN: slab-out-of-bounds in imon_probe+0x2983/0x3910 > Read of size 1 at addr ffff8880436a2c71 by task kworker/1:2/777 > (...) > The buggy address belongs to the object at ffff8880436a2000 > which belongs to the cache kmalloc-4k of size 4096 > The buggy address is located 1 bytes to the right of > allocated 3184-byte region [ffff8880436a2000, ffff8880436a2c70) > > Reported-by: syzbot+59875ffef5cb9c9b29e9@syzkaller.appspotmail.com > Closes: https://lore.kernel.org/all/000000000000a838aa0603cc74d6@google.co/m > Signed-off-by: Ricardo B. Marliere > --- > sound/usb/card.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/usb/card.c b/sound/usb/card.c > index 1b2edc0fd2e9..6578326d33e8 100644 > --- a/sound/usb/card.c > +++ b/sound/usb/card.c > @@ -619,7 +619,7 @@ static int snd_usb_audio_create(struct usb_interface *intf, > } > > err = snd_card_new(&intf->dev, index[idx], id[idx], THIS_MODULE, > - sizeof(*chip), &card); > + sizeof(*chip) + 2, &card); Sorry, it's no-no. We have to fix the cause of the OOB access instead of papering over with a random number of increase. Unfortunately, most important piece of information is trimmed in the changelog, so I can't judge what's going on. The only useful info there is that it's something to do with imon driver, but it's completely independent from USB-audio. How does it access to the external memory allocated by snd-usb-audio driver at all? Before jumping to the solution, we must understand the problem. thanks, Takashi