aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorGerald Schaefer <gerald.schaefer@de.ibm.com>2008-08-21 13:46:40 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2008-08-21 13:46:42 -0400
commit04f64b5756872b474d9429e3b6987ada10bb8012 (patch)
tree3a772f76a2fdbd6e570611202736b1f53b2e4c2d /drivers/s390
parent91c36919a456589f4f073671474a1f899e0d3c2b (diff)
[S390] dcssblk: fix race in dcssblk_add_store()
Concurrently adding the same segment may lead to duplicate device_register() calls, which will trigger an error in kobject code: "... don't try to register things with the same name in the same directory". This patch adds a check to avoid this. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/block/dcssblk.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 01fcdd91b846..db85f1fb131e 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -384,6 +384,10 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
384 * get minor, add to list 384 * get minor, add to list
385 */ 385 */
386 down_write(&dcssblk_devices_sem); 386 down_write(&dcssblk_devices_sem);
387 if (dcssblk_get_segment_by_name(local_buf)) {
388 rc = -EEXIST;
389 goto release_gd;
390 }
387 rc = dcssblk_assign_free_minor(dev_info); 391 rc = dcssblk_assign_free_minor(dev_info);
388 if (rc) { 392 if (rc) {
389 up_write(&dcssblk_devices_sem); 393 up_write(&dcssblk_devices_sem);