]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
ucode: add fix for double registry clear on channel disconnect
authorFelix Fietkau <nbd@nbd.name>
Fri, 9 May 2025 10:04:28 +0000 (12:04 +0200)
committerFelix Fietkau <nbd@nbd.name>
Fri, 9 May 2025 10:05:11 +0000 (12:05 +0200)
Avoid clobbering registry items of unrelated connections.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/utils/ucode/patches/010-ubus-fix-double-registry-clear-on-disconnect.patch [new file with mode: 0644]

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 (file)
index 0000000..70b6a99
--- /dev/null
@@ -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 *