Skip to content

Commit a3eb7fb

Browse files
khoroshilovtorvalds
authored andcommitted
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>
1 parent 3cf8ca1 commit a3eb7fb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/message/i2o/i2o_config.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,19 +754,19 @@ static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd,
754754
unsigned long arg)
755755
{
756756
int ret;
757-
mutex_lock(&i2o_cfg_mutex);
758757
switch (cmd) {
759758
case I2OGETIOPS:
760759
ret = i2o_cfg_ioctl(file, cmd, arg);
761760
break;
762761
case I2OPASSTHRU32:
762+
mutex_lock(&i2o_cfg_mutex);
763763
ret = i2o_cfg_passthru32(file, cmd, arg);
764+
mutex_unlock(&i2o_cfg_mutex);
764765
break;
765766
default:
766767
ret = -ENOIOCTLCMD;
767768
break;
768769
}
769-
mutex_unlock(&i2o_cfg_mutex);
770770
return ret;
771771
}
772772

0 commit comments

Comments
 (0)