drivers/message/i2o/i2o_config.c: fix deadlock in compat_ioctl(I2OGETIOPS)
i2o_cfg_compat_ioctl(I2OGETIOPS) locks i2o_cfg_mutex and then calls i2o_cfg_ioctl(I2OGETIOPS) that locks i2o_cfg_mutex as well. A deadlock is guaranteed. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
3cf8ca1c25
commit
a3eb7fbb41
@@ -754,19 +754,19 @@ static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd,
|
|||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
mutex_lock(&i2o_cfg_mutex);
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case I2OGETIOPS:
|
case I2OGETIOPS:
|
||||||
ret = i2o_cfg_ioctl(file, cmd, arg);
|
ret = i2o_cfg_ioctl(file, cmd, arg);
|
||||||
break;
|
break;
|
||||||
case I2OPASSTHRU32:
|
case I2OPASSTHRU32:
|
||||||
|
mutex_lock(&i2o_cfg_mutex);
|
||||||
ret = i2o_cfg_passthru32(file, cmd, arg);
|
ret = i2o_cfg_passthru32(file, cmd, arg);
|
||||||
|
mutex_unlock(&i2o_cfg_mutex);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -ENOIOCTLCMD;
|
ret = -ENOIOCTLCMD;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mutex_unlock(&i2o_cfg_mutex);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user