($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski at intel.com>
To: ell at lists.01.org
Subject: [PATCH 1/3] acd: Emit event as the last statement in handler
Date: Sat, 11 Jun 2022 03:45:43 +0200	[thread overview]
Message-ID: <20220611014545.1466270-1-andrew.zaborowski@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1188 bytes --]

Move l_acd_stop() to before the call to the event handler for
L_ACD_EVENT_LOST to allow the handler to free the l_acd instance if
needed.
---
 ell/acd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ell/acd.c b/ell/acd.c
index 2d84843..723ae17 100644
--- a/ell/acd.c
+++ b/ell/acd.c
@@ -317,12 +317,12 @@ static bool acd_read_handler(struct l_io *io, void *user_data)
 		if (acd->policy == L_ACD_DEFEND_POLICY_NONE) {
 			ACD_DEBUG("Conflict detected, giving up address");
 
+			l_acd_stop(acd);
+
 			if (acd->event_func)
 				acd->event_func(L_ACD_EVENT_LOST,
 							acd->user_data);
 
-			l_acd_stop(acd);
-
 			break;
 		}
 
@@ -387,6 +387,8 @@ static bool acd_read_handler(struct l_io *io, void *user_data)
 		acd->timeout = NULL;
 
 		ACD_DEBUG("Lost address");
+		l_acd_stop(acd);
+
 		/*
 		* RFC 5227 Section 2.4(b)
 		* "if this is not the first conflicting ARP packet the host has seen,
@@ -398,8 +400,6 @@ static bool acd_read_handler(struct l_io *io, void *user_data)
 		if (acd->event_func)
 			acd->event_func(L_ACD_EVENT_LOST, acd->user_data);
 
-		l_acd_stop(acd);
-
 		break;
 	}
 
-- 
2.34.1

             reply	other threads:[~2022-06-11  1:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-11  1:45 Andrew Zaborowski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-06-13 16:33 [PATCH 1/3] acd: Emit event as the last statement in handler Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220611014545.1466270-1-andrew.zaborowski@intel.com \
    --to=ell@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).