提交 b656688a 编写于 作者: A Alexey Khoroshilov 提交者: James Bottomley

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

[jejb: fixed coding style problems]
Signed-off-by: NAlexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: N"Sreekanth Reddy" <sreekanth.reddy@lsi.com>
Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
上级 f2b0599d
......@@ -2181,10 +2181,12 @@ _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;
else if (mutex_lock_interruptible(&ioc->ctl_cmds.mutex))
if (state == NON_BLOCKING) {
if (!mutex_trylock(&ioc->ctl_cmds.mutex))
return -EAGAIN;
} else if (mutex_lock_interruptible(&ioc->ctl_cmds.mutex)) {
return -ERESTARTSYS;
}
switch (cmd) {
case MPT2IOCINFO:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册