Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3080168yba; Mon, 22 Apr 2019 19:27:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2t1IBhwf8DGJWB31XBA6lDNE9gmgdDFDTBJxpmaxtKqSb9R+47vCyuGxr9k5009zyZgff X-Received: by 2002:a62:4554:: with SMTP id s81mr24558650pfa.66.1555986444111; Mon, 22 Apr 2019 19:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555986444; cv=none; d=google.com; s=arc-20160816; b=jeC3yE8SK4juf2aZek0dvX1lvbv8sKK54U8DayRf49siWOq9IZnnRhEIEYmSm+utpX G9k0VeyfqaoN5ob4ZJm3SnkDUdgDfkUFt/trSGeNVVd5msDk02ecxCJxrYT1MIDFDaG2 V9ISwsaHNoQT1OVm/NzFAIr9o8lirO2vukcECOkj1ExD5yWOf0FftvGnRjuoWUgWI8o0 xX3VN27l74oIKtgofsLT0hWMKJup7XPbzwukluIRiwLSmwf5fyw0z2/qi7G+OZWgZOuq zdLy2z0sJlBnhugUzNllwNu4WIq7GnbyG9fQ8UogEc2a45dNrC2HRFf/jY2XQK8qnRT/ YVRQ== 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=E6fTv0/FbbCpe+j67vyt5IM+onDABcfI9Wnmbo5aGuiVcz6kyeNA5PLVaU467tu4S7 sUA1BUPxBaLreMmvPhXz3z0T7jIWur8mYYc+Z79Fz+eKmb9++oFLhwgEUrcB6tpBHPYl JCjsj99x0Ed6RJwS4pm7IeaMEd/BB3ObHz07CIVkXEOBgw7YKxspQQiBxc4rXzlAPBmq 0D2pqFJTb385/6PhFD6NCxaU5EJq54RLhdqIHiwYAHDZUsinsYq0VKydKZ7eqKB16gpy l4htJGC5rbTHg4gr5ittSGV4nIHbL5p7BM6cp1U6PbY9E4hu3C1UmBmQsgpwXGqSYT+n mMqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2hpNq4y1; 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 y11si15496491plg.39.2019.04.22.19.27.08; Mon, 22 Apr 2019 19:27:24 -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=2hpNq4y1; 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 S1731968AbfDVUBU (ORCPT + 99 others); Mon, 22 Apr 2019 16:01:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:49560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729350AbfDVTq7 (ORCPT ); Mon, 22 Apr 2019 15:46:59 -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 B7AAF21906; Mon, 22 Apr 2019 19:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962418; bh=/5rFM4ws/Ncm0eZbxq4IxZB2/4HtWhMNvmaLbccqTDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2hpNq4y1en7Zu6rqgvTdOBK6T18YQ9oPi8LYdYrpomWeoClG/ybEvgbotHVUmRihB PUT0Iyz/iF1itUCbk09hvXeawPp63HMTdFm47tP0Rrftvowreid63i4ikBzgQNlONH Th3L2ymm8mMiGa42GjxlQAR83pYXYoNBosw66Twk= 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 4.19 52/68] usb: usb251xb: fix to avoid potential NULL pointer dereference Date: Mon, 22 Apr 2019 15:45:00 -0400 Message-Id: <20190422194516.11634-52-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194516.11634-1-sashal@kernel.org> References: <20190422194516.11634-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