bcache: Fix leak of bdev reference
[sfrench/cifs-2.6.git] / drivers / md / bcache / super.c
index 974d832e54a62635c08b21c98a72fe25963b09a6..c3fedd265d184b2408de14ce5fd7d83653026c07 100644 (file)
@@ -1964,6 +1964,8 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
                        else
                                err = "device busy";
                        mutex_unlock(&bch_register_lock);
+                       if (!IS_ERR(bdev))
+                               bdput(bdev);
                        if (attr == &ksysfs_register_quiet)
                                goto out;
                }