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] [day] [month] [year] [list]
Message-ID: <DCD177647606E9419ED923E0C8C4AA7223E20ADBF8@inbmail02.lsi.com>
Date:	Wed, 29 Aug 2012 15:48:06 +0530
From:	"Reddy, Sreekanth" <Sreekanth.Reddy@....com>
To:	Alexey Khoroshilov <khoroshilov@...ras.ru>,
	"James E.J. Bottomley" <JBottomley@...allels.com>
CC:	"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
	"Nandigama, Nagalakshmi" <Nagalakshmi.Nandigama@....com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"ldv-project@...ras.ru" <ldv-project@...ras.ru>
Subject: RE: [PATCH v2] [SCSI] mpt2sas: fix double mutex lock in
 NON_BLOCKING state

James,

This patch seem to be fine. Please consider this patch as Acked-by: "Sreekanth Reddy" <sreekanth.reddy@....com>

Regards,
Sreekanth.

> -----Original Message-----
> From: Alexey Khoroshilov [mailto:khoroshilov@...ras.ru]
> Sent: Tuesday, August 28, 2012 8:08 PM
> To: James E.J. Bottomley
> Cc: Alexey Khoroshilov; linux-scsi@...r.kernel.org; Nandigama,
> Nagalakshmi; Reddy, Sreekanth; linux-kernel@...r.kernel.org; ldv-
> project@...ras.ru
> Subject: [PATCH v2] [SCSI] mpt2sas: fix double mutex lock in
> NON_BLOCKING state
> 
> If state is NON_BLOCKING and mutex_trylock is succeed,
> the control flow goes to mutex_lock_interruptible() that is a deadlock.
> 
> The previous version of the patch becomes obsolete after
> code movement in commit 913809f6.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@...ras.ru>
> ---
>  drivers/scsi/mpt2sas/mpt2sas_ctl.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c
> b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
> index 49bdd2d..d29ea56 100644
> --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c
> +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
> @@ -2181,8 +2181,10 @@ _ctl_ioctl_main(struct file *file, unsigned int
> cmd, void __user *arg,
>  		return -EAGAIN;
> 
>  	state = (file->f_flags & O_NONBLOCK) ? NON_BLOCKING : BLOCKING;
> -	if (state == NON_BLOCKING && !mutex_trylock(&ioc-
> >ctl_cmds.mutex))
> -		return -EAGAIN;
> +	if (state == NON_BLOCKING) {
> +		if (!mutex_trylock(&ioc->ctl_cmds.mutex))
> +			return -EAGAIN;
> +	}
>  	else if (mutex_lock_interruptible(&ioc->ctl_cmds.mutex))
>  		return -ERESTARTSYS;
> 
> --
> 1.7.9.5

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