From 5952b48e251c0ea76dfce97f129da6f18d889eda Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 2 Jul 2025 19:05:08 +0200 Subject: [PATCH] ubusd: do not call socket callback from ubus_msg_send Fixes a crash. Fixes: 713e9d19b2b6 ("ubusd: retry write on EINTR") Signed-off-by: Felix Fietkau --- ubusd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ubusd.c b/ubusd.c index 70ffffb..13557d1 100644 --- a/ubusd.c +++ b/ubusd.c @@ -161,13 +161,12 @@ static void ubus_msg_enqueue(struct ubus_client *cl, struct ubus_msg_buf *ub) /* takes the msgbuf reference */ void ubus_msg_send(struct ubus_client *cl, struct ubus_msg_buf *ub) { - bool write_direct = list_empty(&cl->tx_queue); ssize_t written; if (ub->hdr.type != UBUS_MSG_MONITOR) ubusd_monitor_message(cl, ub, true); - if (write_direct) { + if (list_empty(&cl->tx_queue)) { written = ubus_msg_writev(cl->sock.fd, ub, 0); if (written < 0) @@ -184,7 +183,4 @@ void ubus_msg_send(struct ubus_client *cl, struct ubus_msg_buf *ub) } ubus_msg_enqueue(cl, ub); - - if (write_direct) - cl->sock.cb(&cl->sock, ULOOP_WRITE); } -- 2.30.2