md: fix error path when duplicate name is found on md device creation.
commit042128a85db99144c34a448c75d952cda8b6c19b
authorNeilBrown <neilb@suse.de>
Wed, 1 Jul 2009 02:27:21 +0000 (1 12:27 +1000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Jul 2009 03:38:53 +0000 (19 20:38 -0700)
treed18f52c6a6bb31b9a7c74397b161ea6c7cd42fad
parent5de149123be72b438c5651ac8ca53223ca05a714
md: fix error path when duplicate name is found on md device creation.

commit 1ec22eb2b4a2e1a763106bce36b11c02eaa84e61 upstream.

When an md device is created by name (rather than number) we need to
check that the name is not already in use.  If this check finds a
duplicate, we return an error without dropping the lock or freeing
the newly create mddev.
This patch fixes that.

Found-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/md.c