Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1067665yba; Fri, 3 May 2019 15:30:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOuWDPLWYLRYmhJi/HeaIPyinwdqrXNLGgzVqgnI/Jd8pJ5mR6favaxi1jB0HH6Z2aWipF X-Received: by 2002:a17:902:2a07:: with SMTP id i7mr8473719plb.125.1556922618779; Fri, 03 May 2019 15:30:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556922618; cv=none; d=google.com; s=arc-20160816; b=jl06+63FlOK7p/8CkhKyC2aZ/mY4NkVUX8LWpfJFHbOA3HL3t3+MiYiscvzLagiGSb S75eIWDdi6aqdkaL35Phf0+BC8P3z1ofE0KWyluLRjkeXrmqXMtlq9FCN3rLTVwUoTQC OZ0qlMV2NHKdLRY70YPUMGwghAfZEPshFQsJ+VuEi2dskrlMzUdw3j1zy3cx69SvLnXz whdehIF7+gYuDR3nJm3vGXjn/Ge1CABZV0R9FcLZswoye9ohKtsPc41wZ9H7JECbhnDc HkUHZmp5WnuLatcaVA1K24H/01dknSPD9BHJSqFxcMexyvmAYsd5fXRqk51uRJ1/WDjN sCaQ== 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=j4KmHrwf7yHre0zeYqByyY/vxDFIZN1TUXsiUqztwGQ=; b=UizlrsTUMaZmK0skhjXETNZkULpzrVuCDHdBur4+7WxTEL23DKciFPkvCt018wU4Mp 0TIDqMOLh2Kxz73zZV5v61lu0+KX9II7YGi4qXwewuMxZjSdJfMm4/6Lbm7jXgx74hwl LBReqbqwcPk1iz7TB/TMwIPs+1ichgtnUtdX4sw90YRHZ2BfgNYJM8+lYXPBguFQ2Xfs UOraWEV+AX2T4m4DqtwSgDyTD+8NjSOnYnLZ4agXRRqV44IL88AHKDJmF9caFgrEWjec f782FUSpsYhL6Fy+uU167mHcXwl21jY3S2kR9BK0GZr/ChrmrM+/6rfkUVqGNNsN+1vI AZ/w== 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 n2si4012093pgp.564.2019.05.03.15.30.03; Fri, 03 May 2019 15:30:18 -0700 (PDT) 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 S1726411AbfECVcj (ORCPT + 99 others); Fri, 3 May 2019 17:32:39 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:43717 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725798AbfECVci (ORCPT ); Fri, 3 May 2019 17:32:38 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id A4A3C8029B; Fri, 3 May 2019 23:32:25 +0200 (CEST) Date: Fri, 3 May 2019 23:32:35 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Aditya Pakki , Richard Leitner , "Sasha Levin (Microsoft)" Subject: Re: [PATCH 4.19 57/72] usb: usb251xb: fix to avoid potential NULL pointer dereference Message-ID: <20190503213235.GA9080@amd> References: <20190502143333.437607839@linuxfoundation.org> <20190502143337.920245890@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yrj/dFKFPuw6o+aM" Content-Disposition: inline In-Reply-To: <20190502143337.920245890@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 --yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu 2019-05-02 17:21:19, Greg Kroah-Hartman wrote: > [ Upstream commit 41f00e6e9e55546390031996b773e7f3c1d95928 ] >=20 > of_match_device in usb251xb_probe can fail and returns a NULL pointer. > The patch avoids a potential NULL pointer dereference in this scenario. >=20 > Signed-off-by: Aditya Pakki > Reviewed-by: Richard Leitner > Signed-off-by: Greg Kroah-Hartman > Signed-off-by: Sasha Levin (Microsoft) > --- > drivers/usb/misc/usb251xb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c > index a6efb9a72939..5f7734c729b1 100644 > --- a/drivers/usb/misc/usb251xb.c > +++ b/drivers/usb/misc/usb251xb.c > @@ -601,7 +601,7 @@ static int usb251xb_probe(struct usb251xb *hub) > dev); > int err; > =20 > - if (np) { > + if (np && of_id) { > err =3D usb251xb_get_ofdata(hub, > (struct usb251xb_data *)of_id->data); > if (err) { Are you sure this si correct? If of_id is NULL, this will proceed without setting up hub->conf_data etc. I'd expect it to just return error from probe...? Was this tested? Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --yrj/dFKFPuw6o+aM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlzMs3MACgkQMOfwapXb+vLeUwCffAQl097l+ldIHRzD82ZPEins 9EkAnij+KD3rJiHxpmfiMFZgqIix6iU/ =E/gX -----END PGP SIGNATURE----- --yrj/dFKFPuw6o+aM--