diff mbox series

ubus: fix uhttpd crash

Message ID 20201115091917.7798-1-wojciech.jowsa@gmail.com
State Accepted
Delegated to: Daniel Golle
Headers show
Series ubus: fix uhttpd crash | expand

Commit Message

Wojciech Jowsa Nov. 15, 2020, 9:19 a.m. UTC
Unregister ubus subscriber in notification remove callback.
Without this call, uhttpd crashes when client tries to subscribe to
the ubus object after the object was unregistred and registered again.
It is bacuse the reference to ubus subscriber is not freed but
the memory is cleared in the uh_request_done function.

Signed-off-by: Wojciech Jowsa <wojciech.jowsa@gmail.com>
 ubus.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series


diff --git a/ubus.c b/ubus.c
index cc7447e..619135c 100644
--- a/ubus.c
+++ b/ubus.c
@@ -357,6 +357,8 @@  static void uh_ubus_subscription_notification_remove_cb(struct ubus_context *ctx
 	du = container_of(s, struct dispatch_ubus, sub);
 	cl = container_of(du, struct client, dispatch.ubus);
+	ubus_unregister_subscriber(ctx, &du->sub);