From: Rafał Miłecki <[email protected]>

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 <[email protected]>
---
 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.21.0


_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to