]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.64/drm-sti-sti_vtg-handle-return-null-error-from-devm_ioremap_nocache.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.9.64 / drm-sti-sti_vtg-handle-return-null-error-from-devm_ioremap_nocache.patch
1 From foo@baz Sun Nov 19 11:32:28 CET 2017
2 From: Arvind Yadav <arvind.yadav.cs@gmail.com>
3 Date: Wed, 21 Dec 2016 11:00:12 +0530
4 Subject: drm/sti: sti_vtg: Handle return NULL error from devm_ioremap_nocache
5
6 From: Arvind Yadav <arvind.yadav.cs@gmail.com>
7
8
9 [ Upstream commit 1ae0d5af347df224a6e76334683f13a96d915a44 ]
10
11 Here, If devm_ioremap_nocache will fail. It will return NULL.
12 Kernel can run into a NULL-pointer dereference. This error check
13 will avoid NULL pointer dereference.
14
15 Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
16 Acked-by: Vincent Abriou <vincent.abriou@st.com>
17 Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 ---
20 drivers/gpu/drm/sti/sti_vtg.c | 4 ++++
21 1 file changed, 4 insertions(+)
22
23 --- a/drivers/gpu/drm/sti/sti_vtg.c
24 +++ b/drivers/gpu/drm/sti/sti_vtg.c
25 @@ -429,6 +429,10 @@ static int vtg_probe(struct platform_dev
26 return -ENOMEM;
27 }
28 vtg->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
29 + if (!vtg->regs) {
30 + DRM_ERROR("failed to remap I/O memory\n");
31 + return -ENOMEM;
32 + }
33
34 np = of_parse_phandle(pdev->dev.of_node, "st,slave", 0);
35 if (np) {