Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2776520yba; Mon, 22 Apr 2019 12:45:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7EZd3GbaCth3O4esIpzfQvYka26kXgRkn9VVrzzreYbjV80p98zllTiJVpAr/fZM2Ony8 X-Received: by 2002:a63:4644:: with SMTP id v4mr20770485pgk.422.1555962346235; Mon, 22 Apr 2019 12:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555962346; cv=none; d=google.com; s=arc-20160816; b=dFbj5Hi1MLubD2qbzLRSaQCgwOCXMPIcBY4e69CBYEO5exL8JfDTF2kUmc0GWwqtg+ pkIAPJZUcxe0FpY3O5jqF2kIs34PyfqjlfcsOvPo09n0f/QXU6hcVysv7ou0rpRSt6E3 5iDrwFhL/uG8fBnBC1xlppbumpKkuLJpzVD/1+VKg951cRIuO3XrRlELdONS4lSoxO9+ oGISoOCOgooI74vfcDP7FFgm/QQ/NuTzdDtlsfGyiti+TZdr6hdp+SyO+byRHZoFuNIb F82711bwpNUgWUmfbEM5MjpB2l2H6kX0EO6+HnY2XjoCx7XgK8m/K0ENhtCuWgv1T4Si TD1w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tLH6JWpVQdT6alsryXlDYK/rMeg9AHHmwN/uX+osV1E=; b=TCGlwkTk0V5dBR6EMcZNNHDzGplChNojHt3LqdUTXp+8S3QOR0IJX9+a203ceDM8Up XD23f7Vix2lVWNsYwfaIj+AJAXwiJo2nskXbBKjmwvj/dXWzW59unHVyUPM3iBci8i6h mRQq4nT5MX4KbtfhNndx5gT02G1Iuv2stA84sVbZIV9LXzKut1x9JphXgr1U9xyuKBOw /tEbgVNeZaj0KHDCuX8k81CiC8VTDMLmrtK909FP9tCvK27rPgXDLpYoRX5jxNpKWnDu abxaRGGCsn6DI7I1HFi5eyBbuZcbJP9k0kVXRq4hQu4RUyIXOj20s8Qb7fIBzRZqJj8v c4kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1y1G7GtH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w20si13589088pfi.96.2019.04.22.12.45.30; Mon, 22 Apr 2019 12:45:46 -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=pass header.i=@kernel.org header.s=default header.b=1y1G7GtH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729391AbfDVToM (ORCPT + 99 others); Mon, 22 Apr 2019 15:44:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:45114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729377AbfDVToK (ORCPT ); Mon, 22 Apr 2019 15:44:10 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6EF9C21901; Mon, 22 Apr 2019 19:44:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962250; bh=/5rFM4ws/Ncm0eZbxq4IxZB2/4HtWhMNvmaLbccqTDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1y1G7GtH0ZSuOHllfi0nDplxGCLuljR/1PeT5xhlOoMMkfarN9z6ijA8GAjH0e+kP 9PxYsdiDLJR1JgusCVFG6AOLwigo2GRDwkiKEdgbKYUeE2dUiYO/uAsu9B2/BPKGlt qVW35XCiaTG+WwDWDmmPxY0A3MzjjzC5SGyLSfOI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Aditya Pakki , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 65/98] usb: usb251xb: fix to avoid potential NULL pointer dereference Date: Mon, 22 Apr 2019 15:41:32 -0400 Message-Id: <20190422194205.10404-65-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194205.10404-1-sashal@kernel.org> References: <20190422194205.10404-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aditya Pakki [ Upstream commit 41f00e6e9e55546390031996b773e7f3c1d95928 ] 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 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(-) 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; - if (np) { + if (np && of_id) { err = usb251xb_get_ofdata(hub, (struct usb251xb_data *)of_id->data); if (err) { -- 2.19.1