[PATCH 1/3] acd: move l_acd_stop ahead of EVENT_CONFLICT

James Prestwood <[email protected]> Fri, 31 May 2024 07:55:52 -0700
Newsgroups dev.linux.lists.ell
Message-ID <[email protected]>
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(-)

diff --git a/ell/acd.c b/ell/acd.c
index b913c9b..e7ad416 100644
--- a/ell/acd.c
+++ b/ell/acd.c
@@ -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 */
-- 
2.34.1