From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BF36C31E4A for ; Thu, 13 Jun 2019 15:56:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 36C1D20851 for ; Thu, 13 Jun 2019 15:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560441392; bh=OwZ0qLFkEiHNIobShGBggg/4oh/hdfHyky43omuQniU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BC0F0klOITV+mH5Ec7h2G+9g/tlMywz/9bkkHLMhMV+HOmo/NbgQj2xL1/Dk1gNNa x1GRvG4YqeQQngGniCFQL4px2KWPCEaMqZdMx5fSzr7KfcJb2H3kUHfAFfawZVCJGj UU3gWt9T7uYqoo0J1kGzwTtqEx/jpUctpDKoURv8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731532AbfFMP4H (ORCPT ); Thu, 13 Jun 2019 11:56:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:38772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731527AbfFMIvR (ORCPT ); Thu, 13 Jun 2019 04:51:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C723F206BA; Thu, 13 Jun 2019 08:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560415877; bh=OwZ0qLFkEiHNIobShGBggg/4oh/hdfHyky43omuQniU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SxUlaMUgNedUocdk7KfXx80JUdR64wWUjgV1weOhkzFXpLmC3hyKHEjrLMXvUFo39 txjSg+wXkYoPoSZF7PLyxBW0RprvmnqT/kQzfS/QbBQk813HwugR3K/IRm5n79SsG8 EoINzAtcEriwXpE59VAMmy6XzZ9o8xBxgKwWdBZo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kangjie Lu , Aditya Pakki , Ferenc Bakonyi , Bartlomiej Zolnierkiewicz , Sasha Levin Subject: [PATCH 5.1 129/155] video: hgafb: fix potential NULL pointer dereference Date: Thu, 13 Jun 2019 10:34:01 +0200 Message-Id: <20190613075700.013319542@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190613075652.691765927@linuxfoundation.org> References: <20190613075652.691765927@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ Upstream commit ec7f6aad57ad29e4e66cc2e18e1e1599ddb02542 ] When ioremap fails, hga_vram should not be dereferenced. The fix check the failure to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu Cc: Aditya Pakki Cc: Ferenc Bakonyi [b.zolnierkie: minor patch summary fixup] Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Sasha Levin --- drivers/video/fbdev/hgafb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/hgafb.c b/drivers/video/fbdev/hgafb.c index 463028543173..59e1cae57948 100644 --- a/drivers/video/fbdev/hgafb.c +++ b/drivers/video/fbdev/hgafb.c @@ -285,6 +285,8 @@ static int hga_card_detect(void) hga_vram_len = 0x08000; hga_vram = ioremap(0xb0000, hga_vram_len); + if (!hga_vram) + goto error; if (request_region(0x3b0, 12, "hgafb")) release_io_ports = 1; -- 2.20.1