linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Kangjie Lu <kjlu@umn.edu>, Mukesh Ojha <mojha@codeaurora.org>,
	Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	linux-media@vger.kernel.org
Subject: [PATCH AUTOSEL 4.9 09/73] media: vpss: fix a potential NULL pointer dereference
Date: Mon, 15 Jul 2019 10:35:25 -0400	[thread overview]
Message-ID: <20190715143629.10893-9-sashal@kernel.org> (raw)
In-Reply-To: <20190715143629.10893-1-sashal@kernel.org>

From: Kangjie Lu <kjlu@umn.edu>

[ Upstream commit e08f0761234def47961d3252eac09ccedfe4c6a0 ]

In case ioremap fails, the fix returns -ENOMEM to avoid NULL
pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/platform/davinci/vpss.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/platform/davinci/vpss.c b/drivers/media/platform/davinci/vpss.c
index fce86f17dffc..c2c68988e38a 100644
--- a/drivers/media/platform/davinci/vpss.c
+++ b/drivers/media/platform/davinci/vpss.c
@@ -523,6 +523,11 @@ static int __init vpss_init(void)
 		return -EBUSY;
 
 	oper_cfg.vpss_regs_base2 = ioremap(VPSS_CLK_CTRL, 4);
+	if (unlikely(!oper_cfg.vpss_regs_base2)) {
+		release_mem_region(VPSS_CLK_CTRL, 4);
+		return -ENOMEM;
+	}
+
 	writel(VPSS_CLK_CTRL_VENCCLKEN |
 		     VPSS_CLK_CTRL_DACCLKEN, oper_cfg.vpss_regs_base2);
 
-- 
2.20.1


  parent reply	other threads:[~2019-07-15 14:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190715143629.10893-1-sashal@kernel.org>
2019-07-15 14:35 ` [PATCH AUTOSEL 4.9 06/73] media: dvb: usb: fix use after free in dvb_usb_device_exit Sasha Levin
2019-07-15 14:35 ` [PATCH AUTOSEL 4.9 08/73] media: marvell-ccic: fix DMA s/g desc number calculation Sasha Levin
2019-07-15 14:35 ` Sasha Levin [this message]
2019-07-15 14:35 ` [PATCH AUTOSEL 4.9 10/73] media: media_device_enum_links32: clean a reserved field Sasha Levin
2019-07-15 14:35 ` [PATCH AUTOSEL 4.9 19/73] media: mc-device.c: don't memset __user pointer contents Sasha Levin
2019-07-15 14:35 ` [PATCH AUTOSEL 4.9 20/73] media: staging: media: davinci_vpfe: - Fix for memory leak if decoder initialization fails Sasha Levin
2019-07-15 14:35 ` [PATCH AUTOSEL 4.9 24/73] tua6100: Avoid build warnings Sasha Levin
2019-07-15 14:35 ` [PATCH AUTOSEL 4.9 26/73] media: wl128x: Fix some error handling in fm_v4l2_init_video_device() Sasha Levin
2019-07-15 14:36 ` [PATCH AUTOSEL 4.9 45/73] media: i2c: fix warning same module names Sasha Levin
2019-07-15 14:36 ` [PATCH AUTOSEL 4.9 49/73] media: coda: fix mpeg2 sequence number handling Sasha Levin
2019-07-15 14:36 ` [PATCH AUTOSEL 4.9 50/73] media: coda: increment sequence offset for the last returned frame Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190715143629.10893-9-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab+samsung@kernel.org \
    --cc=mojha@codeaurora.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).