提交 5655c4d9 编写于 作者: A Alex Elder 提交者: Sage Weil

rbd: fix image id leak in initial probe

If a format 2 image id is found for an image being mapped, but the
subsequent probe of the image fails, rbd_dev_probe() quits without
freeing the image id.  Fix that.

Also drop a redundant hunk of code in rbd_dev_image_id().
Signed-off-by: NAlex Elder <elder@inktank.com>
Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
上级 c0fba368
......@@ -4800,16 +4800,20 @@ 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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册