Skip to contentSkip to conversation

acd: move l_acd_stop ahead of EVENT_CONFLICT

PATCH In review James Prestwood 2 participants 4 messages May 31, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 acd: move l_acd_stop ahead of EVENT_CONFLICT

Stopping ACD after the event callback results in an invalid read if the callback destroyed the ACD object. Stopping ACD prior resolves this and is consistent with other call sites.

---
 ell/acd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ell/acd.c +2 -2
index b913c9b..e7ad416 100644
@@ -283,11 +283,11 @@ static bool acd_read_handler(struct l_io *io, void *user_data)
 				target_conflict ? "Target" : "Source",
 				NIPQUAD(acd->ip));
 
+		l_acd_stop(acd);
+
 		if (acd->event_func)
 			acd->event_func(L_ACD_EVENT_CONFLICT, acd->user_data);
 
-		l_acd_stop(acd);
-
 		break;
 	case ACD_STATE_ANNOUNCED:
 		/* Only defend packets with a source conflict */
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/3 icmp6: fix memory leaks with dns_list/domains

Both of these lists were never freed upon freeing the router object

---
 ell/icmp6.c | 8 ++++++++
 1 file changed, 8 insertions(+)
ell/icmp6.c +8 -0
index d94127e..d352955 100644
@@ -787,8 +787,16 @@ struct l_icmp6_router *_icmp6_router_new()
 
 void _icmp6_router_free(struct l_icmp6_router *r)
 {
+	unsigned int i;
+
 	l_free(r->routes);
 	l_free(r->ac_prefixes);
+	l_free(r->dns_list);
+
+	for (i = 0; i < r->n_domains; i++)
+		l_free(r->domains[i].domain);
+
+	l_free(r->domains);
 	l_free(r);
 }
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH 3/3 netconfig: free slaac_domains/slaac_dnses

In reply to James Prestwood

Neither of these queues were freed upon freeing the netconfig object

---
 ell/netconfig.c | 2 ++
 1 file changed, 2 insertions(+)
ell/netconfig.c +2 -0
index 06a717f..9cebdc3 100644
@@ -1410,6 +1410,8 @@ LIB_EXPORT void l_netconfig_destroy(struct l_netconfig *netconfig)
 	l_queue_destroy(netconfig->routes.updated, NULL);
 	l_queue_destroy(netconfig->routes.removed, NULL);
 	l_queue_destroy(netconfig->icmp_route_data, NULL);
+	l_queue_destroy(netconfig->slaac_domains, NULL);
+	l_queue_destroy(netconfig->slaac_dnses, NULL);
 	l_free(netconfig);
 }
 
Signature · 1 line
2.34.1
#3 lore raw
In reply to James Prestwood
Quoted 7 lines · James Prestwood

Stopping ACD after the event callback results in an invalid read if the callback destroyed the ACD object. Stopping ACD prior resolves this and is consistent with other call sites.

---
  ell/acd.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

All applied, thanks.

Regards,
-Denis