[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190309063556.32487-1-kjlu@umn.edu>
Date: Sat, 9 Mar 2019 00:35:56 -0600
From: Kangjie Lu <kjlu@....edu>
To: kjlu@....edu
Cc: pakki001@....edu, Jacob chen <jacob2.chen@...k-chips.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Heiko Stuebner <heiko@...ech.de>, linux-media@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-rockchip@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] media: rga: fix NULL pointer dereferences
In case __get_free_pages fails, return -ENOMEM to avoid NULL
pointer dereferences.
Signed-off-by: Kangjie Lu <kjlu@....edu>
---
drivers/media/platform/rockchip/rga/rga.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c
index 5c653287185f..d42b214977a9 100644
--- a/drivers/media/platform/rockchip/rga/rga.c
+++ b/drivers/media/platform/rockchip/rga/rga.c
@@ -892,8 +892,13 @@ static int rga_probe(struct platform_device *pdev)
rga->src_mmu_pages =
(unsigned int *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 3);
+ if (!rga->src_mmu_pages)
+ return -ENOMEM;
+
rga->dst_mmu_pages =
(unsigned int *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 3);
+ if (!rga->dst_mmu_pages)
+ return -ENOMEM;
def_frame.stride = (def_frame.width * def_frame.fmt->depth) >> 3;
def_frame.size = def_frame.stride * def_frame.height;
--
2.17.1
Powered by blists - more mailing lists