]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] Corrected Oops on omap_vout when no manager is connected
authorFederico Fuga <fuga@studiofuga.com>
Fri, 24 Aug 2012 14:54:11 +0000 (11:54 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Mar 2013 21:31:51 +0000 (18:31 -0300)
If no manager is connected to the vout device, the omapvid_init() function
fails. No error condition is checked, and the device is started. Later on,
when irq is serviced, a NULL pointer dereference occurs.
Also, the isr routine must be registered only if no error occurs, otherwise
the isr triggers without the proper setup, and the kernel oops again.
To prevent this, the error condition is checked, and the streamon function
exits with error. Also the isr registration call is moved after the setup
procedure is completed.

Reviewed-by: Prabhakar Lad <prabhakar.lad@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/platform/omap/omap_vout.c

index 96c4a17e42802df491df16cd4b74a9c4580987bb..477268a2415fd06d58e47eddc5e157b4940fd8c3 100644 (file)
@@ -648,9 +648,12 @@ static void omap_vout_isr(void *arg, unsigned int irqstatus)
 
        /* First save the configuration in ovelray structure */
        ret = omapvid_init(vout, addr);
-       if (ret)
+       if (ret) {
                printk(KERN_ERR VOUT_NAME
                        "failed to set overlay info\n");
+               goto vout_isr_err;
+       }
+
        /* Enable the pipeline and set the Go bit */
        ret = omapvid_apply_changes(vout);
        if (ret)
@@ -1660,13 +1663,16 @@ static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i)
        mask = DISPC_IRQ_VSYNC | DISPC_IRQ_EVSYNC_EVEN | DISPC_IRQ_EVSYNC_ODD
                | DISPC_IRQ_VSYNC2;
 
-       omap_dispc_register_isr(omap_vout_isr, vout, mask);
-
        /* First save the configuration in ovelray structure */
        ret = omapvid_init(vout, addr);
-       if (ret)
+       if (ret) {
                v4l2_err(&vout->vid_dev->v4l2_dev,
                                "failed to set overlay info\n");
+               goto streamon_err1;
+       }
+
+       omap_dispc_register_isr(omap_vout_isr, vout, mask);
+
        /* Enable the pipeline and set the Go bit */
        ret = omapvid_apply_changes(vout);
        if (ret)