linux/drivers/media/platform/ti-vpe
Nikhil Devshatwar c786595beb [media] media: ti-vpe: vpdma: Fix race condition for firmware loading
vpdma_create API is supposed to allocated the struct vpdma_data and
return it to the driver. Also, it would call the callback function
when the VPDMA firmware is loaded.

Typically, VPE driver have following function call:
    dev->vpdma = vpdma_create(pdev, firmware_load_callback);
And the callback implementation would continue the probe further.
Also, the dev->vpdma is accessed from the callback implementation.

This may lead to race condition between assignment of dev->vpdma
and the callback function being triggered.
This would lead to kernel crash because of NULL pointer access.

Fix this by passing a driver wrapped &vpdma_data instead of allocating
inside vpdma_create.
Change the vpdma_create prototype accordingly and fix return paths.

Also, update the VPE driver to use the updated API and
initialize the dev->vpdma before hand so that the race condition
is avoided.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:07:28 -02:00
..
cal_regs.h [media] media: ti-vpe: Add CAL v4l2 camera capture driver 2016-02-01 08:45:26 -02:00
cal.c [media] media: platform: ti-vpe: call of_node_put on non-null pointer 2016-11-18 14:23:33 -02:00
csc.c [media] ti-vpe: fix sparse warnings 2014-11-05 09:09:26 -02:00
csc.h [media] v4l: ti-vpe: Add helper to perform color conversion 2014-01-07 06:57:08 -02:00
Makefile [media] media: ti-vpe: vpdma: Make vpdma library into its own module 2016-11-22 06:24:25 -02:00
sc_coeff.h [media] v4l: ti-vpe: support loading of scaler coefficients 2014-01-07 06:54:48 -02:00
sc.c [media] media: ti-vpe: sc: Fix incorrect optimization 2016-11-22 08:06:27 -02:00
sc.h [media] media: ti-vpe: sc: Fix incorrect optimization 2016-11-22 08:06:27 -02:00
vpdma_priv.h [media] media: ti-vpe: vpdma: RGB data type yield inverted data 2016-11-22 08:05:59 -02:00
vpdma.c [media] media: ti-vpe: vpdma: Fix race condition for firmware loading 2016-11-22 08:07:28 -02:00
vpdma.h [media] media: ti-vpe: vpdma: Fix race condition for firmware loading 2016-11-22 08:07:28 -02:00
vpe_regs.h [media] v4l: ti-vpe: create a color space converter block library 2014-01-07 06:56:18 -02:00
vpe.c [media] media: ti-vpe: vpdma: Fix race condition for firmware loading 2016-11-22 08:07:28 -02:00