Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6549843ybx; Mon, 11 Nov 2019 10:47:26 -0800 (PST) X-Google-Smtp-Source: APXvYqwP3/uliDAz2/BCiXqKkxRwA/S5Zrzt0ymXBHgt0JMqcPmmgr27ypZIoBz7UgkRDX/utXN4 X-Received: by 2002:a17:906:4e99:: with SMTP id v25mr12832808eju.106.1573498046577; Mon, 11 Nov 2019 10:47:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573498046; cv=none; d=google.com; s=arc-20160816; b=tN8XjFMmSxPbei9t61V14MvXNQnEZnLB/jBZTATfcDL+0AnHoFeNDDMtLE5BhjC3Pp u/voXonxFrXwLGawtgIjPe2G/cC3vzhIqUALe9uYdgVnvAiVh/YgTM5joetWtKSRyEqo dzWrAMul/AX5twacrPwjIC3IpSDf/oBTuamWW0Lev42qU3vKt+7uEoknLvAQRW+uREzq 4z8oj3sU+wqsvpQ78uasyfybr8mtp6mkSRPnHibR0Ix5jrrctaJhtCtvcdrLkOZNnPpv KriYg9Xk5KdVRTXOn0DbqyvnO7SbUPvaK/PfT12S2+4YqiJ3lzs/7v2NJyhB5it5K3Dh O/NQ== 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=LV+CcpLz3nwz8Hre49WZMMsoT1xsE61uS8iJ42zM7hI=; b=aP1OFHeVYoaDLLbCODbR/Gcti+H2k5PRLGsg2fDeY9kNVpqBTeL2dBOp793Ol/2ZL6 DQHc66eUJeTHk+E/kYX8QNDWQmUK0t7CgZh0+t405Tbid+N/26YsBXx2Y5S84oXCzfIS eeqTmVyzLYbbX95St/CslOR5SLfHGflEuog24cPXKeYM1VvMG2WaH2DBEpaGv2sj2ZXg gy7UhvpgpapTOQr33sHPIbNryW5FGFJZXMlDP706d78pfv8lGW5JEldg/BuCo+e+KAud 4EOI+i8HsDaiaX9wxnbaWVEuRosQPPIuaTJdR8pMwTCeyCRLKs+eZHcH43YJhqWIK7kF k9Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RfSmzu8m; 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 x37si12746251edd.228.2019.11.11.10.47.02; Mon, 11 Nov 2019 10:47:26 -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=RfSmzu8m; 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 S1729623AbfKKSn3 (ORCPT + 99 others); Mon, 11 Nov 2019 13:43:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:34688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729621AbfKKSnZ (ORCPT ); Mon, 11 Nov 2019 13:43:25 -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 A30F52173B; Mon, 11 Nov 2019 18:43:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573497804; bh=/nHuH0hvuAw08PPOh/q8OkvYcVbuFDtssqgRIWUq81s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RfSmzu8mI1480WJ5AF6p5r2isr15DdjSk0AE4W9KBfh3snnP/myshjHAyg21lpC+H r/R/SvWY/uyy1qFbkA7/PvlYiwWEqylih4tLHQ0u5Y7JJzLQELZzHnNTuiy72zgjn8 hX1DUheqf/JAooOSSfxEhcXddvSdNjMc3BmYRREA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Takashi Iwai Subject: [PATCH 4.19 062/125] ALSA: usb-audio: Fix possible NULL dereference at create_yamaha_midi_quirk() Date: Mon, 11 Nov 2019 19:28:21 +0100 Message-Id: <20191111181448.565879068@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111181438.945353076@linuxfoundation.org> References: <20191111181438.945353076@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 60849562a5db4a1eee2160167e4dce4590d3eafe upstream. The previous addition of descriptor validation may lead to a NULL dereference at create_yamaha_midi_quirk() when either injd or outjd is NULL. Add proper non-NULL checks. Fixes: 57f8770620e9 ("ALSA: usb-audio: More validations of descriptor units") Reported-by: Dan Carpenter Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/quirks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -259,8 +259,8 @@ static int create_yamaha_midi_quirk(stru NULL, USB_MS_MIDI_OUT_JACK); if (!injd && !outjd) return -ENODEV; - if (!snd_usb_validate_midi_desc(injd) || - !snd_usb_validate_midi_desc(outjd)) + if (!(injd && snd_usb_validate_midi_desc(injd)) || + !(outjd && snd_usb_validate_midi_desc(outjd))) return -ENODEV; if (injd && (injd->bLength < 5 || (injd->bJackType != USB_MS_EMBEDDED &&