forked from Minki/linux
4d741cbd58
When driver is built as module and probe during insmod is deferred
because of sensor subdevs, there is NULL pointer deference because
mdev is cleaned up and then access it from v4l2_device_unregister().
Fix the wrong mdev and v4l2 dev order in error path of probe.
This fixes below null pointer deference:
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = ca026f68
[00000000] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
[...]
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
PC is at ida_free+0x7c/0x160
LR is at xas_start+0x44/0x204
[...]
[<c0dafd60>] (ida_free) from [<c083c20c>] (__media_device_unregister_entity+0x18/0xc0)
[<c083c20c>] (__media_device_unregister_entity) from [<c083c2e0>] (media_device_unregister_entity+0x2c/0x38)
[<c083c2e0>] (media_device_unregister_entity) from [<c0843404>] (v4l2_device_release+0xd0/0x104)
[<c0843404>] (v4l2_device_release) from [<c0632558>] (device_release+0x28/0x98)
[<c0632558>] (device_release) from [<c0db1204>] (kobject_put+0xa4/0x208)
[<c0db1204>] (kct_put) from [<bf00bac4>] (fimc_capture_subdev_unregistered+0x58/0x6c [s5p_fimc])
[<bf00bac4>] (fimc_capture_subdev_unregistered [s5p_fimc]) from [<c084a1cc>] (v4l2_device_unregister_subdev+0x6c/0xa8)
[<c084a1cc>] (v4l2_device_unregister_subdev) from [<c084a350>] (v4l2_device_unregister+0x64/0x94)
[<c084a350>] (v4l2_device_unregister) from [<bf0101ac>] (fimc_md_probe+0x4ec/0xaf8 [s5p_fimc])
[...]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Fixes:
|
||
---|---|---|
.. | ||
common.c | ||
common.h | ||
fimc-capture.c | ||
fimc-core.c | ||
fimc-core.h | ||
fimc-is-command.h | ||
fimc-is-errno.c | ||
fimc-is-errno.h | ||
fimc-is-i2c.c | ||
fimc-is-i2c.h | ||
fimc-is-param.c | ||
fimc-is-param.h | ||
fimc-is-regs.c | ||
fimc-is-regs.h | ||
fimc-is-sensor.c | ||
fimc-is-sensor.h | ||
fimc-is.c | ||
fimc-is.h | ||
fimc-isp-video.c | ||
fimc-isp-video.h | ||
fimc-isp.c | ||
fimc-isp.h | ||
fimc-lite-reg.c | ||
fimc-lite-reg.h | ||
fimc-lite.c | ||
fimc-lite.h | ||
fimc-m2m.c | ||
fimc-reg.c | ||
fimc-reg.h | ||
Kconfig | ||
Makefile | ||
media-dev.c | ||
media-dev.h | ||
mipi-csis.c | ||
mipi-csis.h |