Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B072BC433EF for ; Wed, 24 Nov 2021 12:33:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344186AbhKXMgh (ORCPT ); Wed, 24 Nov 2021 07:36:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:42106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243662AbhKXM0S (ORCPT ); Wed, 24 Nov 2021 07:26:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D8F996121D; Wed, 24 Nov 2021 12:16:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637756174; bh=9L5S1wNQqgRAGnTg268+P/TH/VccBWxuhv9lCpuuxG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JnV/Wz8hq0yfrgurIwoE3L3JbGQVDlO6AB/vEH1f6QMg+OiAqrObsFD3qZQP802k5 AmOmK3NnOhDtFat/21uUUS6C7PU0e1MG36rNL8NoccSYEB47MCf44HJJQIGcoaNBHs GvmdZgi2r4zZ0JWAnbDxCvcsyAHQVJ0PNyU0boHU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Yang Yingliang , Sasha Levin Subject: [PATCH 4.9 167/207] usb: host: ohci-tmio: check return value after calling platform_get_resource() Date: Wed, 24 Nov 2021 12:57:18 +0100 Message-Id: <20211124115709.408750070@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211124115703.941380739@linuxfoundation.org> References: <20211124115703.941380739@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yang Yingliang [ Upstream commit 9eff2b2e59fda25051ab36cd1cb5014661df657b ] It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Acked-by: Alan Stern Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20211011134920.118477-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/ohci-tmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c index 9c9e97294c18d..4d42ae3b2fd6d 100644 --- a/drivers/usb/host/ohci-tmio.c +++ b/drivers/usb/host/ohci-tmio.c @@ -199,7 +199,7 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev) if (usb_disabled()) return -ENODEV; - if (!cell) + if (!cell || !regs || !config || !sram) return -EINVAL; if (irq < 0) -- 2.33.0