Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexey Khoroshilov and committed by
Linus Torvalds
a3eb7fbb 3cf8ca1c

+2 -2
+2 -2
drivers/message/i2o/i2o_config.c
··· 754 754 unsigned long arg) 755 755 { 756 756 int ret; 757 - mutex_lock(&i2o_cfg_mutex); 758 757 switch (cmd) { 759 758 case I2OGETIOPS: 760 759 ret = i2o_cfg_ioctl(file, cmd, arg); 761 760 break; 762 761 case I2OPASSTHRU32: 762 + mutex_lock(&i2o_cfg_mutex); 763 763 ret = i2o_cfg_passthru32(file, cmd, arg); 764 + mutex_unlock(&i2o_cfg_mutex); 764 765 break; 765 766 default: 766 767 ret = -ENOIOCTLCMD; 767 768 break; 768 769 } 769 - mutex_unlock(&i2o_cfg_mutex); 770 770 return ret; 771 771 } 772 772