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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F67714A.3070205@redhat.com>
Date:	Mon, 19 Mar 2012 14:47:54 -0300
From:	Mauro Carvalho Chehab <mchehab@...hat.com>
To:	Alexey Khoroshilov <khoroshilov@...ras.ru>
CC:	Mauro Carvalho Chehab <mchehab@...radead.org>,
	Olivier Grenie <olivier.grenie@...com.fr>,
	Patrick Boettcher <pboettcher@...nellabs.com>,
	linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
	ldv-project@...ras.ru
Subject: Re: [PATCH] [media] dib0700: unlock mutexes on error paths

Em 07-03-2012 16:21, Alexey Khoroshilov escreveu:
> dib0700_i2c_xfer [_new and _legacy] leave i2c_mutex locked on error paths.
> The patch adds appropriate unlocks.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@...ras.ru>
> ---
>  drivers/media/dvb/dvb-usb/dib0700_core.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c
> index 070e82a..8ec22c4 100644
> --- a/drivers/media/dvb/dvb-usb/dib0700_core.c
> +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c
> @@ -228,7 +228,7 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg,
>  			/* Write request */
>  			if (mutex_lock_interruptible(&d->usb_mutex) < 0) {
>  				err("could not acquire lock");
> -				return 0;
> +				break;

A break here doesn't sound the right thing to do.

>  			}
>  			st->buf[0] = REQUEST_NEW_I2C_WRITE;
>  			st->buf[1] = msg[i].addr << 1;
> @@ -270,11 +270,14 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap,
>  	struct dib0700_state *st = d->priv;
>  	int i,len;
>  
> -	if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
> +	if (mutex_lock_interruptible(&d->i2c_mutex) < 0) {
> +		err("could not acquire lock");
>  		return -EAGAIN;
> +	}
>  	if (mutex_lock_interruptible(&d->usb_mutex) < 0) {
> +		mutex_unlock(&d->i2c_mutex);
>  		err("could not acquire lock");
> -		return 0;
> +		return -EAGAIN;
>  	}
>  
>  	for (i = 0; i < num; i++) {

--
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