Skip to content

Commit

Permalink
[media] media: saa7146: don't use mutex_lock_interruptible() in devic…
Browse files Browse the repository at this point in the history
…e_release()

Use uninterruptible mutex_lock in the release() file op to make sure all
resources are properly freed when a process is being terminated. Returning
-ERESTARTSYS has no effect for a terminating process and this may cause driver
resources not to be released.
This was found using the following semantic patch (http://coccinelle.lip6.fr/):
<spml>
@r@
identifier fops;
identifier release_func;
@@
static const struct v4l2_file_operations fops = {
.release = release_func
};
@depends on r@
identifier r.release_func;
expression E;
@@
static int release_func(...)
{
...
- if (mutex_lock_interruptible(E)) return -ERESTARTSYS;
+ mutex_lock(E);
...
}
</spml>

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Cyril Roelandt authored and Mauro Carvalho Chehab committed Dec 27, 2012
1 parent 9d7005f commit 21a7339
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/media/common/saa7146/saa7146_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,7 @@ static int fops_release(struct file *file)

DEB_EE("file:%p\n", file);

if (mutex_lock_interruptible(vdev->lock))
return -ERESTARTSYS;
mutex_lock(vdev->lock);

if (vdev->vfl_type == VFL_TYPE_VBI) {
if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE)
Expand Down

0 comments on commit 21a7339

Please sign in to comment.