[PATCH 3.16.y-ckt 39/94] rbd: fix double free on rbd_dev->header_name

Luis Henriques luis.henriques at canonical.com
Fri Nov 13 10:09:33 UTC 2015


3.16.7-ckt20 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ilya Dryomov <idryomov at gmail.com>

commit 3ebe138ac642a195c7f2efdb918f464734421fd6 upstream.

If rbd_dev_image_probe() in rbd_dev_probe_parent() fails, header_name
is freed twice: once in rbd_dev_probe_parent() and then in its caller
rbd_dev_image_probe() (rbd_dev_image_probe() is called recursively to
handle parent images).

rbd_dev_probe_parent() is responsible for probing the parent, so it
shouldn't muck with clone's fields.

Signed-off-by: Ilya Dryomov <idryomov at gmail.com>
Reviewed-by: Alex Elder <elder at linaro.org>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 drivers/block/rbd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 4242da3b09da..59584862a01b 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -5058,7 +5058,6 @@ static int rbd_dev_probe_parent(struct rbd_device *rbd_dev)
 out_err:
 	if (parent) {
 		rbd_dev_unparent(rbd_dev);
-		kfree(rbd_dev->header_name);
 		rbd_dev_destroy(parent);
 	} else {
 		rbd_put_client(rbdc);




More information about the kernel-team mailing list