linux/drivers/media/platform
Javier Martinez Canillas c974c436ea s5p-mfc: Fix race between s5p_mfc_probe() and s5p_mfc_open()
The s5p_mfc_probe() function registers the video devices before all the
resources needed by s5p_mfc_open() are correctly initalized.

So if s5p_mfc_open() function is called before s5p_mfc_probe() finishes
(since the video dev is already registered), a NULL pointer dereference
will happen due s5p_mfc_open() accessing uninitialized vars such as the
struct s5p_mfc_dev .watchdog_timer and .mfc_ops fields.

An example is following BUG caused by add_timer() getting a NULL pointer:

[   45.765374] kernel BUG at kernel/time/timer.c:790!
[   45.765381] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
...
[   45.766149] [<c016fdf4>] (mod_timer) from [<bf181d18>] (s5p_mfc_open+0x274/0x4d4 [s5p_mfc])
[   45.766416] [<bf181d18>] (s5p_mfc_open [s5p_mfc]) from [<bf0214a0>] (v4l2_open+0x9c/0x100 [videodev])
[   45.766547] [<bf0214a0>] (v4l2_open [videodev]) from [<c01e355c>] (chrdev_open+0x9c/0x178)
[   45.766575] [<c01e355c>] (chrdev_open) from [<c01dceb4>] (do_dentry_open+0x1e0/0x300)
[   45.766595] [<c01dceb4>] (do_dentry_open) from [<c01ec2f0>] (path_openat+0x800/0x10d4)
[   45.766610] [<c01ec2f0>] (path_openat) from [<c01ed8b8>] (do_filp_open+0x5c/0xc0)
[   45.766624] [<c01ed8b8>] (do_filp_open) from [<c01de218>] (do_sys_open+0x10c/0x1bc)
[   45.766642] [<c01de218>] (do_sys_open) from [<c01078c0>] (ret_fast_syscall+0x0/0x3c)
[   45.766655] Code: eaffffe3 e3a00001 e28dd008 e8bd81f0 (e7f001f2)

Fix it by registering the video devs as the last step in s5p_mfc_probe().

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
2016-06-03 11:12:29 +02:00
..
am437x [media] am437x-vpfe: fix an uninitialized variable bug 2016-04-13 17:09:55 -03:00
blackfin [media] media: videobuf2: Move timestamp to vb2_buffer 2015-12-18 13:53:31 -02:00
coda media updates for v4.6-rc1 2016-03-16 18:27:32 -07:00
davinci [media] davinci: ccdc_update_raw_params() frees the wrong thing 2016-01-25 15:15:26 -02:00
exynos-gsc [media] exynos-gsc: avoid build warning without CONFIG_OF 2016-05-09 18:38:33 -03:00
exynos4-is Linux 4.6-rc7 2016-05-09 12:21:49 -03:00
marvell-ccic [media] media: videobuf2: Move timestamp to vb2_buffer 2015-12-18 13:53:31 -02:00
omap fbdev changes for 4.5 2016-01-18 11:58:31 -08:00
omap3isp [media] media: Rename is_media_entity_v4l2_io to is_media_entity_v4l2_video_device 2016-04-13 17:20:48 -03:00
s3c-camif [media] media: s3c-camif: fix deadlock on driver probe() 2016-05-02 10:39:58 -03:00
s5p-g2d [media] s5p-g2d: remove non-device-tree init code 2016-04-13 16:25:17 -03:00
s5p-jpeg [media] s5p-jpeg: Adjust buffer size for Exynos 4412 2016-04-13 16:24:15 -03:00
s5p-mfc s5p-mfc: Fix race between s5p_mfc_probe() and s5p_mfc_open() 2016-06-03 11:12:29 +02:00
s5p-tv remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
soc_camera [media] soc_camera: rcar_vin: add R-Car Gen 2 and 3 fallback compatibility strings 2016-04-13 17:17:56 -03:00
sti [media] c8sectpfe: Rework firmware loading mechanism 2016-05-09 12:57:54 -03:00
ti-vpe [media] media: ti-vpe: cal: Fix warning: variable dereference before being checked 2016-02-23 07:17:27 -03:00
vivid [media] tpg: Export the tpg code from vivid as a module 2016-04-20 16:14:39 -03:00
vsp1 [media] v4l: vsp1: Update WPF and LIF maximum sizes for Gen3 2016-04-13 19:16:10 -03:00
xilinx [media] xilinx-vipp: remove unnecessary of_node_put 2016-05-07 11:45:38 -03:00
Kconfig [media] media: platform: rcar_jpu, vsp1: Use ARCH_RENESAS 2016-04-13 19:16:41 -03:00
Makefile [media] timblogiw: move to staging in preparation for removal 2016-02-19 08:10:33 -02:00
arv.c [media] media: remove the setting of the flag V4L2_FL_USE_FH_PRIO 2014-07-04 16:14:59 -03:00
fsl-viu.c [media] fsl-viu: drop format names 2015-08-11 06:59:09 -03:00
m2m-deinterlace.c [media] media: videobuf2: Move timestamp to vb2_buffer 2015-12-18 13:53:31 -02:00
mx2_emmaprp.c [media] media: videobuf2: Move timestamp to vb2_buffer 2015-12-18 13:53:31 -02:00
rcar_jpu.c [media] rcar_jpu: Add R-Car Gen2 Fallback Compatibility String 2016-02-01 09:48:19 -02:00
sh_veu.c [media] media: videobuf2: Move timestamp to vb2_buffer 2015-12-18 13:53:31 -02:00
sh_vou.c [media] media: videobuf2: Move timestamp to vb2_buffer 2015-12-18 13:53:31 -02:00
via-camera.c [media] include/media: split I2C headers from V4L2 core 2015-11-17 06:57:11 -02:00
via-camera.h
vim2m.c [media] vim2m: return error if driver registration fails 2016-02-01 07:37:46 -02:00