[OpenWrt-Devel] [PATCH] ubus: ubus_free: clear pending timers before freeing context
Abhimanyu V
abhimanyu.vishwakarma at imgtec.com
Tue Jan 3 01:07:05 EST 2017
From: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma at imgtec.com>
If a synchronous operation is executed on a ubus context after
uloop_done() has been called, the context's pending_timer
may remain in uloop's list of timeouts.
This leads to undefined behaviour during next execution of uloop
code, as it may be referring to unavailable memory or memory
that has been allocated for different purposes.
Signed-off-by: Marcin Nowakowski <marcin.nowakowski at imgtec.com>
Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma at imgtec.com>
---
libubus.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libubus.c b/libubus.c
index 8163ff7..a044003 100644
--- a/libubus.c
+++ b/libubus.c
@@ -362,6 +362,7 @@ void ubus_shutdown(struct ubus_context *ctx)
if (!ctx)
return;
close(ctx->sock.fd);
+ uloop_timeout_cancel(&ctx->pending_timer);
free(ctx->msgbuf.data);
}
--
2.7.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list