From 5ea47fe35e5db7b231393d21515daeaef9da8498 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 13 Dec 2019 11:05:11 +0100 Subject: [PATCH] blockd: fix vlist memory corruption MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit vlist_add() expects key to point a persistent memory as it doesn't make its copy. Passing blob_attr of current message was resulting in undefined/random behavior including list corruption and possible crashes. Signed-off-by: Rafał Miłecki --- blockd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockd.c b/blockd.c index 88fe168..7375b2b 100644 --- a/blockd.c +++ b/blockd.c @@ -255,7 +255,7 @@ block_hotplug(struct ubus_context *ctx, struct ubus_object *obj, strcpy(_name, devname); device->target = __target; strcpy(__target, target); - vlist_add(&devices, &device->node, blobmsg_get_string(data[MOUNT_DEVICE])); + vlist_add(&devices, &device->node, device->name); } vlist_flush(&devices); -- 2.25.1