From: Javier Martinez Canillas Date: Fri, 7 Oct 2016 20:39:18 +0000 (-0300) Subject: [media] exynos-gsc: unregister video device node on driver removal X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=115a16ba3fa492a13b5530c982fec1ecac5666a1;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [media] exynos-gsc: unregister video device node on driver removal The driver doesn't unregister the video device node when the driver is removed, this keeps video device nodes that makes the machine to crash with a NULL pointer dereference when nodes are attempted to be opened: [ 36.530006] Unable to handle kernel paging request at virtual address bf1f8200 [ 36.535985] pgd = edbbc000 [ 36.538486] [bf1f8200] *pgd=6d99a811, *pte=00000000, *ppte=00000000 [ 36.544727] Internal error: Oops: 7 [#1] PREEMPT SMP ARM [ 36.550016] Modules linked in: s5p_jpeg s5p_mfc v4l2_mem2mem videobuf2_dma_contig [ 36.566303] CPU: 6 PID: 533 Comm: v4l2-ctl Not tainted 4.8.0 [ 36.574466] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 36.580526] task: ee3cc600 task.stack: ed626000 [ 36.585046] PC is at try_module_get+0x1c/0xac [ 36.589364] LR is at try_module_get+0x1c/0xac [ 36.593698] pc : [] lr : [] psr: 80070013 [ 36.593698] sp : ed627de0 ip : a0070013 fp : 00000000 [ 36.605156] r10: 00000002 r9 : ed627ed0 r8 : 00000000 [ 36.610331] r7 : c01e5f14 r6 : ed57be00 r5 : bf1f8200 r4 : bf1f8200 [ 36.616834] r3 : 00000002 r2 : 00000002 r1 : 01930192 r0 : 00000001 .. [ 36.785004] [] (try_module_get) from [] (cdev_get+0x1c/0x4c) [ 36.792362] [] (cdev_get) from [] (chrdev_open+0x2c/0x178) [ 36.799555] [] (chrdev_open) from [] (do_dentry_open+0x1e0/0x300) [ 36.807360] [] (do_dentry_open) from [] (path_openat+0x35c/0xf58) [ 36.815154] [] (path_openat) from [] (do_filp_open+0x5c/0xc0) [ 36.822606] [] (do_filp_open) from [] (do_sys_open+0x10c/0x1bc) [ 36.830235] [] (do_sys_open) from [] (ret_fast_syscall+0x0/0x3c) [ 36.837942] Code: 0a00001c e1a04000 e3a00001 ebfec92d (e5943000) Signed-off-by: Javier Martinez Canillas Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index a1cac52ea230..c8c0bcec35ed 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -781,6 +781,8 @@ err_m2m_release: void gsc_unregister_m2m_device(struct gsc_dev *gsc) { - if (gsc) + if (gsc) { v4l2_m2m_release(gsc->m2m.m2m_dev); + video_unregister_device(&gsc->vdev); + } }