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 5EDDAC43217 for ; Wed, 24 Nov 2021 13:29:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349957AbhKXNdA (ORCPT ); Wed, 24 Nov 2021 08:33:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:60596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351279AbhKXNag (ORCPT ); Wed, 24 Nov 2021 08:30:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id CFFAA61549; Wed, 24 Nov 2021 12:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637758329; bh=wywaTOUg4rQhajJSmVTWOlOkW6JYAOE/z69eL1ZC92g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D3K9pbpQY3v5ekoy4/I180uFQR+hLRXaw74ZBWFGhZbYpeW61B/8fKblSfIkabaD9 0gMOSB+9wqGS0fgIZLbW4fNk7GO97/RL7THQjw2rDnu2JERJQmbOzzuxp2uFjYJiAx Gb1uYp6Mycz8V953LQCd6djpJISpzIKTJXU67Tzg= 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 5.10 032/154] usb: host: ohci-tmio: check return value after calling platform_get_resource() Date: Wed, 24 Nov 2021 12:57:08 +0100 Message-Id: <20211124115703.400726665@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211124115702.361983534@linuxfoundation.org> References: <20211124115702.361983534@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 08ec2ab0d95a5..3f3d62dc06746 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