diff options
-rw-r--r-- | drivers/block/rbd.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 0ddcbe584a1f..815c174661a8 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -4800,17 +4800,21 @@ static int rbd_dev_probe(struct rbd_device *rbd_dev) ret = rbd_dev_v1_probe(rbd_dev); else ret = rbd_dev_v2_probe(rbd_dev); - if (ret) { - dout("probe failed, returning %d\n", ret); - - return ret; - } + if (ret) + goto out_err; ret = rbd_dev_probe_finish(rbd_dev); if (ret) rbd_header_free(&rbd_dev->header); return ret; +out_err: + kfree(rbd_dev->spec->image_id); + rbd_dev->spec->image_id = NULL; + + dout("probe failed, returning %d\n", ret); + + return ret; } static ssize_t rbd_add(struct bus_type *bus, |