summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2025-05-09 10:04:28 +0000
committerFelix Fietkau2025-06-12 12:33:54 +0000
commit7dd96329ef0893918df292c1de73481f3fd7fbf4 (patch)
tree6cc6351029afe69913b990cf5e0c89e45408d2e5
parent9d7aa9abade44d6af83a217b09fa47af65732e35 (diff)
downloadopenwrt-7dd96329ef0893918df292c1de73481f3fd7fbf4.tar.gz
ucode: add fix for double registry clear on channel disconnect
Avoid clobbering registry items of unrelated connections. Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry picked from commit eaab68be92ab1a469ac448732f3297ee1444c980)
-rw-r--r--package/utils/ucode/patches/010-ubus-fix-double-registry-clear-on-disconnect.patch26
1 files changed, 26 insertions, 0 deletions
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@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@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 *