public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Cyril Roelandt <tipecaml@gmail.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	michael@mihu.de, mchehab@redhat.com, linux-media@vger.kernel.org
Subject: Re: [PATCH 1/1] media: saa7146: don't use mutex_lock_interruptible() in device_release().
Date: Tue, 11 Dec 2012 07:22:19 +0000	[thread overview]
Message-ID: <201212110822.19555.hverkuil@xs4all.nl> (raw)
In-Reply-To: <1355195128-10209-2-git-send-email-tipecaml@gmail.com>

On Tue December 11 2012 04:05:28 Cyril Roelandt wrote:
> 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.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Thanks!

	Hans

> 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>
> ---
>  drivers/media/common/saa7146/saa7146_fops.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c
> index b3890bd..0afe98d 100644
> --- a/drivers/media/common/saa7146/saa7146_fops.c
> +++ b/drivers/media/common/saa7146/saa7146_fops.c
> @@ -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)
> 

      reply	other threads:[~2012-12-11  7:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-11  3:05 [PATCH 0/1] media: saa7146: don't use mutex_lock_interruptible in Cyril Roelandt
2012-12-11  3:05 ` [PATCH 1/1] media: saa7146: don't use mutex_lock_interruptible() in device_release() Cyril Roelandt
2012-12-11  7:22   ` Hans Verkuil [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201212110822.19555.hverkuil@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=michael@mihu.de \
    --cc=tipecaml@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox