lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 11 Dec 2012 08:22:19 +0100
From:	Hans Verkuil <hverkuil@...all.nl>
To:	Cyril Roelandt <tipecaml@...il.com>
Cc:	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
	michael@...u.de, mchehab@...hat.com, linux-media@...r.kernel.org
Subject: Re: [PATCH 1/1] media: saa7146: don't use mutex_lock_interruptible() in device_release().

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@...co.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@...il.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)
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ