Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759907AbYF0Gxm (ORCPT ); Fri, 27 Jun 2008 02:53:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759148AbYF0GuU (ORCPT ); Fri, 27 Jun 2008 02:50:20 -0400 Received: from ns1.suse.de ([195.135.220.2]:46732 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759116AbYF0GuR (ORCPT ); Fri, 27 Jun 2008 02:50:17 -0400 From: NeilBrown To: Andrew Morton Date: Fri, 27 Jun 2008 16:50:10 +1000 Message-Id: <1080627065010.10418@suse.de> X-face: [Gw_3E*Gng}4rRrKRYotwlE?.2|**#s9D Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1332 Lines: 35 There is a possible race in md_probe. If two threads call md_probe for the same device, then one could exit (having checked that ->gendisk exists) before the other has called kobject_init_and_add, thus returning an incomplete kobj which will cause problems when we try to add children to it. So extend the range of protection of disks_mutex slightly to avoid this possibility. Signed-off-by: Neil Brown ### Diffstat output ./drivers/md/md.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff .prev/drivers/md/md.c ./drivers/md/md.c --- .prev/drivers/md/md.c 2008-06-27 15:31:27.000000000 +1000 +++ ./drivers/md/md.c 2008-06-27 15:31:35.000000000 +1000 @@ -3359,9 +3359,9 @@ static struct kobject *md_probe(dev_t de disk->queue = mddev->queue; add_disk(disk); mddev->gendisk = disk; - mutex_unlock(&disks_mutex); error = kobject_init_and_add(&mddev->kobj, &md_ktype, &disk->dev.kobj, "%s", "md"); + mutex_unlock(&disks_mutex); if (error) printk(KERN_WARNING "md: cannot register %s/md - name in use\n", disk->disk_name); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/