diff mbox series

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

Message ID 20240531145554.601087-1-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/3] acd: move l_acd_stop ahead of EVENT_CONFLICT | expand

Commit Message

James Prestwood May 31, 2024, 2:55 p.m. UTC
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(-)

Comments

Denis Kenzior May 31, 2024, 3:13 p.m. UTC | #1
On 5/31/24 9:55 AM, James Prestwood wrote:
> 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
diff mbox series

Patch

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 */