Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3525587pxf; Mon, 15 Mar 2021 11:30:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZC6Hh111xAu92nF56DJ99F+AQQvWU5Ia2spc6X/ePRGiWiba12155eBeQFPzyW1Ps0RuR X-Received: by 2002:a05:6402:c88:: with SMTP id cm8mr31478568edb.62.1615833015158; Mon, 15 Mar 2021 11:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833015; cv=none; d=google.com; s=arc-20160816; b=mAOeDSXGYWaaGdjdIY7MVLxf04X/B11ALVYEysLwrq1zjCaLf8fScXyhnRMUgP3L6/ jK9j6nRolGggFn8kDT+lCSCCMZvYhjcDi6wRDeuUm42HKMKlluGp1fZXyNUvqPQpbYx4 N26iWxv2PQaiGcrpDGXKHvVn1CBzn6KnJZaG+MvqPtCmYEmjQP2EHc1nxvYdAhV3z55Y fpdxFAAwPHTVnL17PiDCGk/p5xNkRC4uVVghxoxwXI77eDbcRkoKNMDlTjL8mfH7NZle TAxQgIIF1jTadwbop4U4ErhzlBWso0ChpBg0FHwSi/pbUpDUxX1T0OSCtzu4Jj2Hx+2S CFBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Fqe2EjyEnWyeesbAfuedPgvT3KV7fCB3w1LdzQ5rMgc=; b=s4h6cDFKT9BenW9CXWkah04RgxEifDEGrRrC2A9xg7txs/Lux1zqWfsp3DG+fCDg8I PLLfkrDOTY4UKUHKxfTmTJaRm0Gdlczyz/0cbgGFVx4AyckA080rbBnGf5DhryIq9/iH h7uX0GfXKc/lzix1SaFxiTo8IqyCXPxeUV7e76UiL6iW1enVSX3CdOhv1p8Vy9cRSHeD KxbcESG+ZdC+Us3CdOyFuV+RxX6Po/MsJn3BwlmiRT8OXLI2w2ALCcTXSMSycvDWTnWc OU1MWWR57lfrgNiA0x3zfdl1Y7crwR55jawr1jMc/EiO7+gKq30lGqbqDs7oPH9YXbdw djpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="omNq/IC0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si4395174edq.562.2021.03.15.11.29.52; Mon, 15 Mar 2021 11:30:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="omNq/IC0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239314AbhCOOgT (ORCPT + 99 others); Mon, 15 Mar 2021 10:36:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:47676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233488AbhCOOBq (ORCPT ); Mon, 15 Mar 2021 10:01:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E307464EF0; Mon, 15 Mar 2021 14:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816906; bh=nYYfGvw9M3nnKskYW4kUBBeFG0i2to+aKSbS+MN64gk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=omNq/IC0MzCbXPG+X1yKZ/6Ud6TDUguaTqWuQs52rBZAO9OjhrdpKQVQN2/VuaCd1 MkpthDYugYMl8uOh1UHrxgT32SQ6WlpG51JtEaZX3fwAocQtRz5VzrGUPWTnEK24j9 JSVk7VDbwmcZbsKBWqfIuYdRtEav/kkH32g1NP6I= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+719da9b149a931f5143f@syzkaller.appspotmail.com, Pavel Skripkin , Takashi Iwai Subject: [PATCH 5.10 181/290] ALSA: usb-audio: fix NULL ptr dereference in usb_audio_probe Date: Mon, 15 Mar 2021 14:54:34 +0100 Message-Id: <20210315135548.036672620@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Pavel Skripkin commit 30dea07180de3aa0ad613af88431ef4e34b5ef68 upstream. syzbot reported null pointer dereference in usb_audio_probe. The problem was in case, when quirk == NULL. It's not an error condition, so quirk must be checked before dereferencing. Call Trace: usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396 really_probe+0x291/0xe60 drivers/base/dd.c:554 driver_probe_device+0x26b/0x3d0 drivers/base/dd.c:740 __device_attach_driver+0x1d1/0x290 drivers/base/dd.c:846 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:431 __device_attach+0x228/0x4a0 drivers/base/dd.c:914 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:491 device_add+0xbdb/0x1db0 drivers/base/core.c:3242 usb_set_configuration+0x113f/0x1910 drivers/usb/core/message.c:2164 usb_generic_driver_probe+0xba/0x100 drivers/usb/core/generic.c:238 usb_probe_device+0xd9/0x2c0 drivers/usb/core/driver.c:293 really_probe+0x291/0xe60 drivers/base/dd.c:554 driver_probe_device+0x26b/0x3d0 drivers/base/dd.c:740 __device_attach_driver+0x1d1/0x290 drivers/base/dd.c:846 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:431 __device_attach+0x228/0x4a0 drivers/base/dd.c:914 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:491 device_add+0xbdb/0x1db0 drivers/base/core.c:3242 usb_new_device.cold+0x721/0x1058 drivers/usb/core/hub.c:2555 hub_port_connect drivers/usb/core/hub.c:5223 [inline] hub_port_connect_change drivers/usb/core/hub.c:5363 [inline] port_event drivers/usb/core/hub.c:5509 [inline] hub_event+0x2357/0x4320 drivers/usb/core/hub.c:5591 process_one_work+0x98d/0x1600 kernel/workqueue.c:2275 worker_thread+0x64c/0x1120 kernel/workqueue.c:2421 kthread+0x3b1/0x4a0 kernel/kthread.c:292 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 Reported-by: syzbot+719da9b149a931f5143f@syzkaller.appspotmail.com Fixes: 9799110825db ("ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend()") Signed-off-by: Pavel Skripkin Cc: Link: https://lore.kernel.org/r/f1ebad6e721412843bd1b12584444c0a63c6b2fb.1615242183.git.paskripkin@gmail.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/card.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -830,7 +830,8 @@ static int usb_audio_probe(struct usb_in snd_media_device_create(chip, intf); } - chip->quirk_type = quirk->type; + if (quirk) + chip->quirk_type = quirk->type; usb_chip[chip->index] = chip; chip->intf[chip->num_interfaces] = intf;