Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1362212img; Tue, 19 Mar 2019 06:12:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxg4haZpxL6vZ7sOn0+c0HIWpJlJJNiORsXMffBjhDwKDlqs/DWjMOnD4xzoJ4UAMvusPKd X-Received: by 2002:a17:902:a511:: with SMTP id s17mr2483169plq.262.1553001142858; Tue, 19 Mar 2019 06:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553001142; cv=none; d=google.com; s=arc-20160816; b=i74HVxnXdfOBzXNShI0HFa8sJpCg5sE9Pe1MOQXSUSvQJZN4DSGTl3dPL9ZbE0f8jD 2qXjidYQZPiKYLgNm5plsOBx4ge7ySM7SMhnWOsZM0aK22x5vvZPpJsrTQnn5MKGzCHT +2YBna+mjU1bYo3FseE0IFmXHLhQ5j2RW2NwOdCRdFK7eDDEWyGCrXaLC69JAdT9LW2O /TH44IfJTFj5k9L1MQjkoN6OSOGCrIBQYFEwngxQ5RNuFJ0taRlAml2bURwb89ve13SL aj3UP+TGtOOk1Hw5XE4MDF4FFEzjEXwd8bkvf6UG72FiggXoby/jP+NHGVcPLDLcBKPy Ptrg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr :dkim-signature; bh=ccSt7aW++eMPFwJHw6inD5tEw+xdIi8msYb4iZLSKVY=; b=LhegYOskhbMwldx3db5nJCm63OBK9lJWZeVZcpiaqN2Cw3xwDfuxlW8Ib2/ImgQTw7 Ku+b/WSm2zP7dCQNCztz/WbNu5RyJBsnZ9ApbmMBAInX35fe3ABcfaAEFB7rhtlw6tyN U5MtKi23NKRkX02VbzpQauDDymV7bEPZLkD9d7wOwSYaxeVXhz/kyeqcQMnnh6zIvJaV KVgo12+GF53GO40ZbQHkOksgF7YHAjAFPoCa/ttqDYTdpenzU9C0s18AoEd5OHhbkR8C QP9HP9MJbfRG8bxYGzyaKxo6LheVeQeKarzl1XqATb9NXHvvfhMiruChgvhGDsqplbo9 QT/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@skidata.com header.s=selector1 header.b=V4rtM+Am; 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 f124si11823029pgc.103.2019.03.19.06.12.06; Tue, 19 Mar 2019 06:12:22 -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; dkim=fail header.i=@skidata.com header.s=selector1 header.b=V4rtM+Am; 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 S1726876AbfCSNL0 (ORCPT + 99 others); Tue, 19 Mar 2019 09:11:26 -0400 Received: from mail1.skidata.com ([91.230.2.99]:45039 "EHLO mail1.skidata.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726464AbfCSNL0 (ORCPT ); Tue, 19 Mar 2019 09:11:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=skidata.com; i=@skidata.com; q=dns/txt; s=selector1; t=1553001085; x=1584537085; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=YZ4J5UTncLJ/PTFt2yYwAjChO7oWMvH/+rMsTnRSgfw=; b=V4rtM+AmerDXPPGQIeVtvjSqr6XaqAIG2LBM0vwmVgUpYkOtd/0Mue79 FbCjwInPRAvGKWJXEHuZ6U7Efhdrw0BV8xJ0xvAGjKYbVxOycB6fFDlFr Auppo1Atvax65Z06Yve1+F3vC60+8F++1qLNA9dVjgh/Lsa4xZ/Vg7LuM xpd7UPIvEd8Ab+o50kG4jl85/d+yTd94zwl6i2edPih8qW1F8G4MLpu4M J8j6cPt5NKXEZ7PQKFnaY757lbI9wmRxlfZJHD4m7ZG6C+Fh169HrLkON yTyOmVgX0ieZY2T4k03Zoz9RT8z07oIpvegTkJCSoLMMELfmKauJBN9zQ Q==; IronPort-SDR: 5j2gXmfIar4y/PK4X+4aMPH0oLHne63aFz8r1AihWn59PVIvIuiYdsJYaat5I7hg1rSjjyQl0T iVQmYhbo47DUcX8Ousg9Pr8sl7+eqmkl69PMMkL3zIR6UamJFjK+kuIwDekHG5K0uaGZPPcHah Oiz9p4mXVnSucZSlrPuM6CKwFhoHj7kyn73v0/bhQqbRlJFwJWfCrw6LDs4nEaxcsmNWx9HTgF 40LzYNyWzlRrlSrA1JiP4oHNb0eYs4SKdSGbLlmq1rOVWhlHSY/uF1DICln9UrI4SVcPo38ml7 zag= X-IronPort-AV: E=Sophos;i="5.58,498,1544482800"; d="scan'208";a="15841402" Subject: Re: [PATCH] usb: usb251xb: fix to avoid potential NULL pointer dereference To: Aditya Pakki CC: , Greg Kroah-Hartman , , References: <20190318235605.11055-1-pakki001@umn.edu> From: Richard Leitner Message-ID: <3579fc19-dde7-968b-3918-39f1cc4ee3bc@skidata.com> Date: Tue, 19 Mar 2019 14:11:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190318235605.11055-1-pakki001@umn.edu> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.111.22] X-ClientProxiedBy: sdex5srv.skidata.net (192.168.111.83) To sdex5srv.skidata.net (192.168.111.83) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/03/2019 00:56, Aditya Pakki wrote: > of_match_device in usb251xb_probe can fail and returns a NULL pointer. > The patch avoids a potential NULL pointer dereference in this scenario. > > Signed-off-by: Aditya Pakki > --- > drivers/usb/misc/usb251xb.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c > index 4d72b7d1d383..fe5266dc8864 100644 > --- a/drivers/usb/misc/usb251xb.c > +++ b/drivers/usb/misc/usb251xb.c > @@ -612,6 +612,8 @@ static int usb251xb_probe(struct usb251xb *hub) > dev); > int err; > > + if (!of_id) > + return -ENODEV; Hi Aditya, thanks for finding this issue! Nonetheless I'd prefer to change this to not return here but rather do something like: if (np && of_id) { So we still may bring up the hub in its default config in scenarios without dt/of... Any comments/objections on that? regards;Richard.L > if (np) { > err = usb251xb_get_ofdata(hub, > (struct usb251xb_data *)of_id->data); >