Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6001443ybc; Wed, 27 Nov 2019 13:11:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzEZVU8OkP+retPiN/8pDLCZwqxVz34TY6zXFKv2jKhwAR1fL7X+ouHWKtXZhDGkCedO6FH X-Received: by 2002:a50:f612:: with SMTP id c18mr35024617edn.285.1574889106546; Wed, 27 Nov 2019 13:11:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574889106; cv=none; d=google.com; s=arc-20160816; b=nj8SRjKiGOEROgQ5o16z9C6eipIZYWaSt8G4dwSBw0+ZahYBmUvE94FCTkDKRifXUA FeM1qNywAkXBNhoQ0m2mCaQ6fnAHl/H+amlaj5jyVNmzExkydK97ddP/YA6JomJ5BTIN 3pxPp4i4HUAIPN0wK/QSrv7ZGqhG4TC5VPHCWVTdAn155FwwwUaQUSV9vgwoQSIB8IBi vliTF6SQPGbZM/+9TbWsrOydKPvonPv5W1gYt4+htii1viB0UOpHa2UKtMPaJeuyLwK8 kQNMOKUX/kNY8UOmA7dqr+de0DgoKQgprTK6oQQpxY1s+SabYVC37SkdvNvdkYTJXx0M 3ZYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eLX4zWo9gDLHa/sUdyAhU3e/olUT7pK6mVkLKIjpw0A=; b=tK981aoA+cIyRJwY66i9Z0xyePnQJMLS/Kony82pSDkNQVkpKkE90Z5JETCZx5ldRL rUpIR2G5XjnKVuSgfGNfMG9IG7aYD01IAB6NZRj/C9/GcVXo7guAtAN/YSZwESHpyXdf bwWQ1GPjYqfwPwjethQpxyzcujHOGOOw1a1KwcE14cM0dHUzFHPUywFfK7t03zJ8Ld+V sk7QexsYPvzYkm+CP3MwaQkM747vjsBVH+Q1blHnXLPXcuoA5OWxF9vkUZqfwAuJ6ZHs uylSABrsuzIvFDSN11Ccve0dzGLMn2vnTtGxVf75//wZTan4bs5sCzjUQTKx9yuh76JS S1hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nL9T8hW+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dc21si10491027ejb.101.2019.11.27.13.11.23; Wed, 27 Nov 2019 13:11:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nL9T8hW+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732639AbfK0VHl (ORCPT + 99 others); Wed, 27 Nov 2019 16:07:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:33856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732032AbfK0VHi (ORCPT ); Wed, 27 Nov 2019 16:07:38 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BE07D20637; Wed, 27 Nov 2019 21:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888858; bh=O4kljrPt375tBeZnHIE1KU1ZosopXyMxljzp2rRX/gg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nL9T8hW+m9M1VGOqejePn1P9JMQROGN8uw73bSZm75r0disBYXIqtQzVSG9OUNQOl 9u9rtuZeoqmgOXN+ZFKw1y2tMZswIKcgRZlFtLm0MaLl6T3Vg61qiKlQ86RIc8K9/v /vWu5ddj/6f3bkW7Ln1qTYXnKjQoEJ7pS/vtzs/c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+a36ab65c6653d7ccdd62@syzkaller.appspotmail.com, Dan Carpenter , Takashi Iwai Subject: [PATCH 4.19 280/306] ALSA: usb-audio: Fix NULL dereference at parsing BADD Date: Wed, 27 Nov 2019 21:32:10 +0100 Message-Id: <20191127203135.243292483@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai commit 9435f2bb66874a0c4dd25e7c978957a7ca2c93b1 upstream. snd_usb_mixer_controls_badd() that parses UAC3 BADD profiles misses a NULL check for the given interfaces. When a malformed USB descriptor is passed, this may lead to an Oops, as spotted by syzkaller. Skip the iteration if the interface doesn't exist for avoiding the crash. Fixes: 17156f23e93c ("ALSA: usb: add UAC3 BADD profiles support") Reported-by: syzbot+a36ab65c6653d7ccdd62@syzkaller.appspotmail.com Suggested-by: Dan Carpenter Cc: Link: https://lore.kernel.org/r/20191122112840.24797-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/mixer.c | 3 +++ 1 file changed, 3 insertions(+) --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -2949,6 +2949,9 @@ static int snd_usb_mixer_controls_badd(s continue; iface = usb_ifnum_to_if(dev, intf); + if (!iface) + continue; + num = iface->num_altsetting; if (num < 2)