diff mbox series

[2/2] manager: handle -ENODEV special in interface callback

Message ID 20230117180343.1451626-2-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/2] wiphy: prevent multiple wiphy registrations | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood Jan. 17, 2023, 6:03 p.m. UTC
If IWD ends up dumping wiphy's twice (because of NEW_WIPHY event
soon after initial dump) it will also try and dump interfaces
twice leading to multiple DEL_INTERFACE calls. The second attempt
will fail with -ENODEV (since the interface was already deleted).
Just silently fail with this case and let the other DEL_INTERFACE
path handle the re-creation.
---
 src/manager.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/manager.c b/src/manager.c
index fed02777..f1aa59c7 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -320,13 +320,18 @@  static void manager_setup_cmd_done(void *user_data)
 static void manager_del_interface_cb(struct l_genl_msg *msg, void *user_data)
 {
 	struct wiphy_setup_state *state = user_data;
+	int err;
 
 	l_debug("");
 
 	if (state->aborted)
 		return;
 
-	if (l_genl_msg_get_error(msg) < 0) {
+	err = l_genl_msg_get_error(msg);
+
+	if (err == -ENODEV)
+		return;
+	else if (err < 0) {
 		l_error("DEL_INTERFACE failed: %s",
 			strerror(-l_genl_msg_get_error(msg)));
 		state->use_default = true;