]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
unetmsg: add null check in TX disconnect callback
authorFelix Fietkau <nbd@nbd.name>
Sun, 4 Jan 2026 10:04:58 +0000 (10:04 +0000)
committerFelix Fietkau <nbd@nbd.name>
Mon, 5 Jan 2026 11:43:40 +0000 (12:43 +0100)
The network may be deleted before the disconnect callback fires.
Check for null to avoid crash when accessing net.tx_channels.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc

index 59d9b0c278169ffabd3806411e5d4aa4c07a18fd..63be3cbab04f513b1032e03b5dab66674a8da48f 100644 (file)
@@ -350,6 +350,11 @@ function network_open_channel(net, name, peer)
 
        let disconnect_cb = (req) => {
                let net = networks[sock_data.network];
+               if (!net) {
+                       network_tx_socket_close(sock_data);
+                       return;
+               }
+
                let cur_data = net.tx_channels[sock_data.name];
                if (cur_data == sock_data)
                        delete net.tx_channels[sock_data.name];