[PATCH 7/7] drm/exynos/crtc: add NULL checks before accessing crtc
Andrzej Hajda
a.hajda at samsung.com
Thu Nov 13 08:37:48 PST 2014
exynos_drm_crtc_disable_vblank can be called when drm initialization fails.
In such case some structures are not initialized, so the function
should check it. The patch adds necessary checks.
It fixes following Oops:
[ 1.521834] Unable to handle kernel NULL pointer dereference at virtual address 00000348
...
[ 1.801740] [<c02687a0>] (exynos_drm_crtc_disable_vblank) from [<c0252200>] (vblank_disable_and_save+0x74/0x1e8)
[ 1.811893] [<c0252200>] (vblank_disable_and_save) from [<c02535c0>] (drm_vblank_cleanup+0x50/0x80)
[ 1.820918] [<c02535c0>] (drm_vblank_cleanup) from [<c026791c>] (exynos_drm_load+0xe8/0x118)
[ 1.829338] [<c026791c>] (exynos_drm_load) from [<c025472c>] (drm_dev_register+0xa0/0x100)
[ 1.837585] [<c025472c>] (drm_dev_register) from [<c02563a8>] (drm_platform_init+0x40/0xd0)
[ 1.845919] [<c02563a8>] (drm_platform_init) from [<c0276968>] (try_to_bring_up_master.part.2+0xc8/0x104)
[ 1.855467] [<c0276968>] (try_to_bring_up_master.part.2) from [<c0276a48>] (component_master_add_with_match+0xa4/0x124)
[ 1.866227] [<c0276a48>] (component_master_add_with_match) from [<c0267a58>] (exynos_drm_platform_probe+0x10c/0x158)
[ 1.876731] [<c0267a58>] (exynos_drm_platform_probe) from [<c027bc70>] (platform_drv_probe+0x48/0xa4)
[ 1.885932] [<c027bc70>] (platform_drv_probe) from [<c027a840>] (driver_probe_device+0x10c/0x22c)
[ 1.894784] [<c027a840>] (driver_probe_device) from [<c027a9ec>] (__driver_attach+0x8c/0x90)
[ 1.903203] [<c027a9ec>] (__driver_attach) from [<c0279080>] (bus_for_each_dev+0x54/0x88)
[ 1.911363] [<c0279080>] (bus_for_each_dev) from [<c027a040>] (bus_add_driver+0xd4/0x1d0)
[ 1.919522] [<c027a040>] (bus_add_driver) from [<c027b014>] (driver_register+0x78/0xf4)
[ 1.927507] [<c027b014>] (driver_register) from [<c0267b08>] (exynos_drm_init+0x64/0x8c)
[ 1.935580] [<c0267b08>] (exynos_drm_init) from [<c0008924>] (do_one_initcall+0x80/0x1b8)
[ 1.943743] [<c0008924>] (do_one_initcall) from [<c060cd40>] (kernel_init_freeable+0xfc/0x1c8)
[ 1.952334] [<c060cd40>] (kernel_init_freeable) from [<c0447e04>] (kernel_init+0x8/0xec)
[ 1.960406] [<c0447e04>] (kernel_init) from [<c000e738>] (ret_from_fork+0x14/0x3c)
Signed-off-by: Andrzej Hajda <a.hajda at samsung.com>
---
drivers/gpu/drm/exynos/exynos_drm_crtc.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 45026e6..e05fe12 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -406,9 +406,14 @@ int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe)
void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe)
{
struct exynos_drm_private *private = dev->dev_private;
- struct exynos_drm_crtc *exynos_crtc =
- to_exynos_crtc(private->crtc[pipe]);
- struct exynos_drm_manager *manager = exynos_crtc->manager;
+ struct exynos_drm_crtc *exynos_crtc;
+ struct exynos_drm_manager *manager;
+
+ if (!private->crtc[pipe])
+ return;
+
+ exynos_crtc = to_exynos_crtc(private->crtc[pipe]);
+ manager = exynos_crtc->manager;
if (exynos_crtc->dpms != DRM_MODE_DPMS_ON)
return;
--
1.9.1
More information about the dri-devel
mailing list