The patch titled md: fix lock imbalance has been added to the -mm tree. Its filename is md-fix-lock-imbalance.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: md: fix lock imbalance From: Jiri Slaby <jirislaby@xxxxxxxxx> Add unlock and put to one of fail paths in md_alloc. Andre said: This patch fixes a leak and a locking bug which hits if a named array is being added and its name duplicates the name of an already existing array. Signed-off-by: Jiri Slaby <jirislaby@xxxxxxxxx> Acked-by: Andre Noll <maan@xxxxxxxxxxxxxxx> Cc: Neil Brown <neilb@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/md/md.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff -puN drivers/md/md.c~md-fix-lock-imbalance drivers/md/md.c --- a/drivers/md/md.c~md-fix-lock-imbalance +++ a/drivers/md/md.c @@ -3829,7 +3829,7 @@ static int md_alloc(dev_t dev, char *nam int partitioned; int shift; int unit; - int error; + int error, ret; if (!mddev) return -ENODEV; @@ -3845,9 +3845,8 @@ static int md_alloc(dev_t dev, char *nam mutex_lock(&disks_mutex); if (mddev->gendisk) { - mutex_unlock(&disks_mutex); - mddev_put(mddev); - return -EEXIST; + ret = -EEXIST; + goto unlock; } if (name) { @@ -3860,16 +3859,16 @@ static int md_alloc(dev_t dev, char *nam if (mddev2->gendisk && strcmp(mddev2->gendisk->disk_name, name) == 0) { spin_unlock(&all_mddevs_lock); - return -EEXIST; + ret = -EEXIST; + goto unlock; } spin_unlock(&all_mddevs_lock); } mddev->queue = blk_alloc_queue(GFP_KERNEL); if (!mddev->queue) { - mutex_unlock(&disks_mutex); - mddev_put(mddev); - return -ENOMEM; + ret = -ENOMEM; + goto unlock; } mddev->queue->queuedata = mddev; @@ -3883,8 +3882,8 @@ static int md_alloc(dev_t dev, char *nam mutex_unlock(&disks_mutex); blk_cleanup_queue(mddev->queue); mddev->queue = NULL; - mddev_put(mddev); - return -ENOMEM; + ret = -ENOMEM; + goto put; } disk->major = MAJOR(mddev->unit); disk->first_minor = unit << shift; @@ -3914,8 +3913,13 @@ static int md_alloc(dev_t dev, char *nam kobject_uevent(&mddev->kobj, KOBJ_ADD); mddev->sysfs_state = sysfs_get_dirent(mddev->kobj.sd, "array_state"); } + ret = 0; +put: mddev_put(mddev); - return 0; + return ret; +unlock: + mutex_unlock(&disks_mutex); + goto put; } static struct kobject *md_probe(dev_t dev, int *part, void *data) _ Patches currently in -mm which might be from jirislaby@xxxxxxxxx are origin.patch floppy-fix-lock-imbalance.patch linux-next.patch isdn-hisax-fix-lock-imbalance.patch icom-converting-space-to-tabs.patch base-firmware_class-fix-lock-imbalance.patch md-fix-lock-imbalance.patch wireless-nl80211-fix-lock-imbalance.patch reiser4.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html