[openwrt/openwrt] ucode: add fix for double registry clear on channel disconnect

LEDE Commits lede-commits at lists.infradead.org
Fri May 9 03:05:30 PDT 2025


nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/eaab68be92ab1a469ac448732f3297ee1444c980

commit eaab68be92ab1a469ac448732f3297ee1444c980
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Fri May 9 12:04:28 2025 +0200

    ucode: add fix for double registry clear on channel disconnect
    
    Avoid clobbering registry items of unrelated connections.
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 ...s-fix-double-registry-clear-on-disconnect.patch | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/package/utils/ucode/patches/010-ubus-fix-double-registry-clear-on-disconnect.patch b/package/utils/ucode/patches/010-ubus-fix-double-registry-clear-on-disconnect.patch
new file mode 100644
index 0000000000..70b6a99be7
--- /dev/null
+++ b/package/utils/ucode/patches/010-ubus-fix-double-registry-clear-on-disconnect.patch
@@ -0,0 +1,26 @@
+From: Felix Fietkau <nbd at nbd.name>
+Date: Fri, 9 May 2025 11:57:57 +0200
+Subject: [PATCH] ubus: fix double registry clear on disconnect
+
+Set c->registry_index to -1 in order to ensure that the resource free path
+does not clobber registry items of unrelated connections.
+
+Signed-off-by: Felix Fietkau <nbd at nbd.name>
+---
+
+--- a/lib/ubus.c
++++ b/lib/ubus.c
+@@ -2375,8 +2375,11 @@ uc_ubus_channel_disconnect_cb(struct ubu
+ 		c->ctx.sock.fd = -1;
+ 	}
+ 
+-	if (c->registry_index >= 0)
+-		connection_reg_clear(c->vm, c->registry_index);
++	if (c->registry_index >= 0) {
++		int idx = c->registry_index;
++		c->registry_index = -1;
++		connection_reg_clear(c->vm, idx);
++	}
+ }
+ 
+ static uc_value_t *




More information about the lede-commits mailing list