Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1664212ybc; Wed, 13 Nov 2019 02:23:02 -0800 (PST) X-Google-Smtp-Source: APXvYqzdcexJY/fyjJOJku3g7wpWTxmtdlBqQe8FUd2GtTe06Bg2m6/WuYcq7qXrHAqELlzVUxAO X-Received: by 2002:a05:6402:6cf:: with SMTP id n15mr2537747edy.269.1573640582708; Wed, 13 Nov 2019 02:23:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573640582; cv=none; d=google.com; s=arc-20160816; b=z4l80cR/5e1K/WaL8le2YhnbC3BeYliwBjNnHRZ3PfXUsjvqQUsHMxhkUcTtjRqsz6 xLFzK4Unx9i2IMUJcpXee4Hfb92MXRu8m0qIS3lfbA9YbysHb6i4YU5Xnu/lcBvvbjIl fsJovXyjPcblVFYw5OvUCWe9dLuFzOEhT1UA9woSYIaVCFfooFv4mwt9HYSwfkqmlltT escDj/vr2R37IsR8ngHivMrUZuER8mPOTJw/zF/XrqrPPq1/ODIOS9lQpStUXaWwckHY 6ags4iKgGQ838zflJW2KLMBogtXEtjc7ZTqwjQHFPB/ErhoOMYw02w3EXlfmYNDBziVc kcIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=m4HDkJnJ4rkJ0fyZU4/+Jmdzpk/PsorDwlHRqvwQx1Y=; b=INezU22QxlwBrVg/FJW4Gc8qoR2qY2Ha1LGnhK62vuNnBqhbP8OqaI3ZuavwO9uMwL JDxxv0x7FK8k1yPrVp2f7q4b207pH4XkoEC27imV4VpZd/8RUMdM/bCGVr820g+I69po UunibQ6QKE9HLjhMqdHE+tSM+iKc6tN5DWB9jFipbLIBW1Eg30t+t7iP0i0jBY3zcf9t Ya79/RIbqw/2HiFotOZ2Dq54KAhl99jAtW631yshXeiNhdx6YidHp4x4u71xPh9gQeW2 zmF4Nxs/I0FqzQ8Ms5kdN51/esDPIGmB83QHQluqlE1rSKy2MbG3pV8+xqiZ5L2IObmb /CTA== ARC-Authentication-Results: i=1; mx.google.com; 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 z16si1114191edi.241.2019.11.13.02.22.38; Wed, 13 Nov 2019 02:23:02 -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; 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 S1727229AbfKMKT5 (ORCPT + 99 others); Wed, 13 Nov 2019 05:19:57 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:44722 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726613AbfKMKT4 (ORCPT ); Wed, 13 Nov 2019 05:19:56 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 06E5C1C1229; Wed, 13 Nov 2019 11:19:54 +0100 (CET) Date: Wed, 13 Nov 2019 11:19:54 +0100 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Dan Carpenter , Takashi Iwai Subject: Re: [PATCH 4.19 062/125] ALSA: usb-audio: Fix possible NULL dereference at create_yamaha_midi_quirk() Message-ID: <20191113101954.GA32553@amd> References: <20191111181438.945353076@linuxfoundation.org> <20191111181448.565879068@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OXfL5xGRrasGEqWY" Content-Disposition: inline In-Reply-To: <20191111181448.565879068@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Takashi Iwai >=20 > commit 60849562a5db4a1eee2160167e4dce4590d3eafe upstream. >=20 > 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. This is wrong. > @@ -259,8 +259,8 @@ static int create_yamaha_midi_quirk(stru > NULL, USB_MS_MIDI_OUT_JACK); > if (!injd && !outjd) > return -ENODEV; Clearly code wants to allow at most one of them to be NULL. > - 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; Yet it will return here if it is. Correct check would be + if (!(!injd || snd_usb_validate_midi_desc(injd)) || + !(!outjd || snd_usb_validate_midi_desc(outjd))) AFAICT. Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --OXfL5xGRrasGEqWY Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl3L2MoACgkQMOfwapXb+vKkvwCfQwemC8SZ0emRIQydohEHDrpA oQwAn1dEXHbybsKKrhheQUqGeQG0zE90 =bi0F -----END PGP SIGNATURE----- --OXfL5xGRrasGEqWY--