diff --git a/drivers/md/md.c b/drivers/md/md.c index 939739f0f881..5fcce7371ee9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4014,8 +4014,10 @@ new_dev_store(struct mddev *mddev, const char *buf, size_t len) else rdev = md_import_device(dev, -1, -1); - if (IS_ERR(rdev)) + if (IS_ERR(rdev)) { + mddev_unlock(mddev); return PTR_ERR(rdev); + } err = bind_rdev_to_array(rdev, mddev); out: if (err)