Skip to contentSkip to conversation

ARM: OMAP 2: Camera: Fix device release

PATCH In review Sakari Ailus 2 participants 2 messages Dec 4, 2007 – Dec 5, 2007 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: OMAP 2: Camera: Fix device release

If streaming wasn't stopped before a file handle was closed, videobuf_streamoff got called after cam->streaming had been set NULL, causing an oops. Call videobuf_streamoff a bit earlier instead.

---
 drivers/media/video/omap24xxcam.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/media/video/omap24xxcam.c +3 -2
index d394eab..96f4885 100644
@@ -1510,12 +1510,13 @@ static int omap24xxcam_release(struct inode *inode, struct file *file)
 
 	flush_scheduled_work();
 
-	mutex_lock(&cam->mutex);
 	/* stop streaming capture */
+	videobuf_streamoff(&fh->vbq);
+
+	mutex_lock(&cam->mutex);
 	if (cam->streaming == file) {
 		cam->streaming = NULL;
 		mutex_unlock(&cam->mutex);
-		videobuf_streamoff(&fh->vbq);
 		sysfs_notify(&cam->dev->kobj, NULL, "streaming");
 	} else {
 		mutex_unlock(&cam->mutex);
Signature · 1 line
1.5.0.6
#1 lore raw
Quoted 20 lines · Sakari Ailus

If streaming wasn't stopped before a file handle was closed, videobuf_streamoff got called after cam->streaming had been set NULL, causing an oops. Call videobuf_streamoff a bit earlier instead.

---
 drivers/media/video/omap24xxcam.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/media/video/omap24xxcam.c +0 -1
index d394eab..96f4885 100644
@@ -1510,12 +1510,13 @@ static int omap24xxcam_release(struct inode *inode, struct file *file)
 
 	flush_scheduled_work();
 
-	mutex_lock(&cam->mutex);
 	/* stop streaming capture */

drivers/media/video/omap24xxcam.c static int omap24xxcam_release(struct inode *inode, struct file *file) · line 1522

Quoted 10 lines
drivers/media/video/omap24xxcam.c +3 -1
+	videobuf_streamoff(&fh->vbq);
+
+	mutex_lock(&cam->mutex);
 	if (cam->streaming == file) {
 		cam->streaming = NULL;
 		mutex_unlock(&cam->mutex);
-		videobuf_streamoff(&fh->vbq);
 		sysfs_notify(&cam->dev->kobj, NULL, "streaming");
 	} else {
 		mutex_unlock(&cam->mutex);

Pushing today

Tony