1
0
Fork 0
alistair23-linux/drivers/s390/block
Gerald Schaefer 1378a68344 s390/dcssblk: fix possible deadlock in remove vs. per-device attributes
dcssblk_remove_store() holds the dcssblk_devices_sem semaphore while
calling device_unregister(), which in turn tries to acquire the kernfs
kn->dev_map rwsem for the device sysfs subtree. The same rwsem is also
acquired when using the per-device sysfs attributes in the device sub-tree,
and the attribute handlers then also acquire the dcssblk_devices_sem.

This can lead to a deadlock when removing a DCSS while concurrently
reading from / writing to one of its sysfs attributes. The following
lockdep warning hinted towards the issue (CPU0 = dcssblk_remove_store,
CPU1 = dcssblk_shared_store):

[   76.496047]  Possible unsafe locking scenario:

[   76.496054]        CPU0                    CPU1
[   76.496059]        ----                    ----
[   76.496087]   lock(&dcssblk_devices_sem);
[   76.496090]                                lock(s_active#175);
[   76.496106]                                lock(&dcssblk_devices_sem);
[   76.496110]   lock(s_active#175);
[   76.496115]
 *** DEADLOCK ***

Fix this by releasing the dcssblk_devices_sem semaphore, which only
protects internal DCSS data, before calling device_unregister().

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2016-04-15 18:01:44 +02:00
..
Kconfig s390/scm_block: force cluster writes 2012-09-26 15:45:01 +02:00
Makefile s390/scm_block: force cluster writes 2012-09-26 15:45:01 +02:00
dasd.c s390/dasd: fix performance drop 2016-02-17 09:24:07 +01:00
dasd_3990_erp.c s390/time: rename tod clock access functions 2013-02-14 15:55:10 +01:00
dasd_alias.c s390/dasd: reorder lcu and device lock 2016-03-17 13:18:25 +01:00
dasd_devmap.c s390: Use pr_warn instead of pr_warning 2016-03-07 13:12:04 +01:00
dasd_diag.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2016-03-16 10:47:45 -07:00
dasd_diag.h s390: remove 31 bit support 2015-03-25 11:49:33 +01:00
dasd_eckd.c s390/dasd: reorder lcu and device lock 2016-03-17 13:18:25 +01:00
dasd_eckd.h s390/dasd: reorder lcu and device lock 2016-03-17 13:18:25 +01:00
dasd_eer.c s390/time: rename tod clock access functions 2013-02-14 15:55:10 +01:00
dasd_erp.c s390/dasd: fix statistics for recovered requests 2013-08-28 09:19:34 +02:00
dasd_fba.c s390/dasd: remove casts to dasd_*_private 2016-03-07 13:12:02 +01:00
dasd_fba.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
dasd_genhd.c s390: Use pr_warn instead of pr_warning 2016-03-07 13:12:04 +01:00
dasd_int.h s390/dasd: reorder lcu and device lock 2016-03-17 13:18:25 +01:00
dasd_ioctl.c s390: Use pr_warn instead of pr_warning 2016-03-07 13:12:04 +01:00
dasd_proc.c s390: Use pr_warn instead of pr_warning 2016-03-07 13:12:04 +01:00
dcssblk.c s390/dcssblk: fix possible deadlock in remove vs. per-device attributes 2016-04-15 18:01:44 +02:00
scm_blk.c s390/scm_blk: fix deadlock for requests != REQ_TYPE_FS 2016-04-01 17:20:54 +02:00
scm_blk.h s390/scm_block: make the number of reqs per HW req configurable 2014-12-08 09:42:47 +01:00
scm_blk_cluster.c s390/scm_block: fix off by one during cluster reservation 2015-02-26 09:24:47 +01:00
scm_drv.c s390/scm_block: fix printk format string 2013-03-21 13:35:37 +01:00
xpram.c block: change ->make_request_fn() and users to return a queue cookie 2015-11-07 10:40:46 -07:00