Skip to content

Commit

Permalink
net: dns: Close socket service properly from dispatcher
Browse files Browse the repository at this point in the history
We need to close the socket service context when dispatcher is
unregistered.

Fixes #82652

Signed-off-by: Jukka Rissanen <[email protected]>
(cherry picked from commit da148ab)
  • Loading branch information
jukkar authored and dkalowsk committed Dec 27, 2024
1 parent fc639b6 commit d58e1ea
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions subsys/net/lib/dns/dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ int dns_dispatcher_unregister(struct dns_socket_dispatcher *ctx)

(void)sys_slist_find_and_remove(&sockets, &ctx->node);

(void)net_socket_service_unregister(ctx->svc);

/* Mark the context as unregistered */
ctx->sock = -1;

for (int i = 0; i < ctx->fds_len; i++) {
CHECKIF((int)ctx->fds[i].fd >= (int)ARRAY_SIZE(dispatch_table)) {
ret = -ERANGE;
Expand Down

0 comments on commit d58e1ea

Please sign in to comment.