Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2449243ybi; Sat, 1 Jun 2019 16:54:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7Gb6/xe8eg96cLRmz0blWzsvuNrtrcdOHEtdHSY2bx2CRyTpxiq0pnb7nzShVORq21upq X-Received: by 2002:a17:902:8f96:: with SMTP id z22mr19870347plo.248.1559433298692; Sat, 01 Jun 2019 16:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559433298; cv=none; d=google.com; s=arc-20160816; b=OLZeO9gKBLF/JTF8S2ri0c+XHEo0eyi8c7/+2T9pF/SYAoa6vifaxUFt9AZ8F4zTm3 Uje8Fwyi95UunkeCZj0BwTawpVe9UZI13yVEonQq1UXMplzy7BE9SLcnzoXqw6vSF5+L 4qgApH0Dvr5g53aVBUNkc8j0Wp/AVt6FNP6h2kodQ/Mpk4ki4rQWlkG2ROGdvsORS9NU tKn3f011i+DGGAU47iPF69wEY3EiVr3hWiBmu92Z7Wf4ozGYA5BMrfWjwC62Ie69E4K2 DCh5fbKBlGex0SwoWaZEKesi/4jeJbZIanRm/t49vya7HSr9AyjhL5SWt/V3pDFNsr9O fj4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date; bh=Wsz/5xeu7DEuVSz37fILoCfoWNpWjRisRcxxdkJYS70=; b=pzQ3DfV27zfEU0PPF+PyTTjH5c6MbhMSqgh+4DK2z6iyL8BC1w3XPwfsmkfJdCbTwr lop08lXlunz89CrszET6IpnIPLHqeByyq4zkFiKPpJXmrpdtWEPH2wUEfqpYVB1I7L50 itguZ+zNIWnUC1nIRL4K4Jq1zJOLDM6k2k0pIDHZK9siGSMwvk+ikDSIgYUbbnuZdRxm 4DSVLn0zN3AswfN2XvPXDq2fE3YIV7jjwshl9MctdlmKnv0jTCHPTx/56LRztd3lratG a7q4V4FFwp9Sf5srPaSEBV41b8LIAjK4FKFdv5qGlOBsddfCcNMHd0/CJ/iPkMB3noTq F3HA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1si12387400pld.432.2019.06.01.16.54.42; Sat, 01 Jun 2019 16:54:58 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726628AbfFAXxm (ORCPT + 99 others); Sat, 1 Jun 2019 19:53:42 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:33760 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbfFAXxl (ORCPT ); Sat, 1 Jun 2019 19:53:41 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id D444327652; Sat, 1 Jun 2019 19:53:37 -0400 (EDT) Date: Sun, 2 Jun 2019 09:53:47 +1000 (AEST) From: Finn Thain To: Kangjie Lu cc: Bartlomiej Zolnierkiewicz , Greg Kroah-Hartman , Sasha Levin , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Aditya Pakki , Rob Herring , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH AUTOSEL 4.4 44/56] video: imsttfb: fix potential NULL pointer dereferences In-Reply-To: <20190601161929.GA5028@kroah.com> Message-ID: References: <20190601132600.27427-1-sashal@kernel.org> <20190601132600.27427-44-sashal@kernel.org> <20190601161929.GA5028@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 1 Jun 2019, Greg Kroah-Hartman wrote: > On Sat, Jun 01, 2019 at 09:25:48AM -0400, Sasha Levin wrote: > > From: Kangjie Lu > > > > [ Upstream commit 1d84353d205a953e2381044953b7fa31c8c9702d ] > > ... > > Why only 4.4.y? Shouldn't this be queued up for everything or none? > > thanks, > > greg k-h > Also, why not check the result of the other ioremap calls? (I should have checked that when this first crossed my inbox...) From 1d84353d205a953e2381044953b7fa31c8c9702d Mon Sep 17 00:00:00 2001 From: Kangjie Lu Date: Mon, 1 Apr 2019 17:46:58 +0200 Subject: [PATCH] video: imsttfb: fix potential NULL pointer dereferences In case ioremap fails, the fix releases resources and returns -ENOMEM to avoid NULL pointer dereferences. Signed-off-by: Kangjie Lu Cc: Aditya Pakki Cc: Finn Thain Cc: Rob Herring Cc: Greg Kroah-Hartman [b.zolnierkie: minor patch summary fixup] Signed-off-by: Bartlomiej Zolnierkiewicz diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c index 4b9615e4ce74..35bba3c2036d 100644 --- a/drivers/video/fbdev/imsttfb.c +++ b/drivers/video/fbdev/imsttfb.c @@ -1515,6 +1515,11 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) info->fix.smem_start = addr; info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ? 0x400000 : 0x800000); + if (!info->screen_base) { + release_mem_region(addr, size); + framebuffer_release(info); + return -ENOMEM; + } info->fix.mmio_start = addr + 0x800000; par->dc_regs = ioremap(addr + 0x800000, 0x1000); par->cmap_regs_phys = addr + 0x840000;