* Fw: [PATCH] Corrected Oops on omap_vout when no manager is connected
@ 2012-09-15 16:06 Mauro Carvalho Chehab
2012-09-17 12:24 ` Prabhakar Lad
0 siblings, 1 reply; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2012-09-15 16:06 UTC (permalink / raw)
To: Prabhakar Lad; +Cc: LMML
Prabhakar,
Please review.
Thanks!
Mauro
Forwarded message:
Date: Fri, 24 Aug 2012 17:54:11 +0200
From: Federico Fuga <fuga@studiofuga.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: linux-media@vger.kernel.org, Federico Fuga <fuga@studiofuga.com>
Subject: [PATCH] Corrected Oops on omap_vout when no manager is connected
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.
---
drivers/media/video/omap/omap_vout.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c
index 15c5f4d..f456587 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -650,9 +650,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)
@@ -1678,13 +1681,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)
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Regards,
Mauro
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Fw: [PATCH] Corrected Oops on omap_vout when no manager is connected
2012-09-15 16:06 Fw: [PATCH] Corrected Oops on omap_vout when no manager is connected Mauro Carvalho Chehab
@ 2012-09-17 12:24 ` Prabhakar Lad
0 siblings, 0 replies; 2+ messages in thread
From: Prabhakar Lad @ 2012-09-17 12:24 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: Prabhakar Lad, LMML
On Sat, Sep 15, 2012 at 9:36 PM, Mauro Carvalho Chehab
<mchehab@redhat.com> wrote:
> Prabhakar,
>
> Please review.
>
> Thanks!
> Mauro
>
> Forwarded message:
>
> Date: Fri, 24 Aug 2012 17:54:11 +0200
> From: Federico Fuga <fuga@studiofuga.com>
> To: Mauro Carvalho Chehab <mchehab@infradead.org>
> Cc: linux-media@vger.kernel.org, Federico Fuga <fuga@studiofuga.com>
> Subject: [PATCH] Corrected Oops on omap_vout when no manager is connected
>
>
> 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>
Regards,
--Prabhakar
> ---
> drivers/media/video/omap/omap_vout.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c
> index 15c5f4d..f456587 100644
> --- a/drivers/media/video/omap/omap_vout.c
> +++ b/drivers/media/video/omap/omap_vout.c
> @@ -650,9 +650,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)
> @@ -1678,13 +1681,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)
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
> --
> Regards,
> Mauro
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-17 12:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-15 16:06 Fw: [PATCH] Corrected Oops on omap_vout when no manager is connected Mauro Carvalho Chehab
2012-09-17 12:24 ` Prabhakar Lad
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).