Wireless Daemon for Linux
 help / color / mirror / Atom feed
* [PATCH 1/2] frame-xchg: Fix frame_watch_remove_by_handler for group 0
@ 2020-05-31  0:56 Andrew Zaborowski
  2020-05-31  0:56 ` [PATCH 2/2] frame-xchg: Use frame_watch_group_match in frame_watch_group_get Andrew Zaborowski
  2020-06-04 14:19 ` [PATCH 1/2] frame-xchg: Fix frame_watch_remove_by_handler for group 0 Denis Kenzior
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Zaborowski @ 2020-05-31  0:56 UTC (permalink / raw)
  To: iwd

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

Don't match the default group's (group_id 0) wdev_id against the
provided wdev_id because the default group can be used on all wdevs and
its wdev_id is 0.  Also match individual item's wdev_id in the group to
make up for this although it normally wouldn't matter.
---
 src/frame-xchg.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/frame-xchg.c b/src/frame-xchg.c
index 4c950fd3..44711997 100644
--- a/src/frame-xchg.c
+++ b/src/frame-xchg.c
@@ -661,6 +661,7 @@ bool frame_watch_wdev_remove(uint64_t wdev_id)
 }
 
 struct frame_watch_handler_check_info {
+	uint64_t wdev_id;
 	frame_watch_cb_t handler;
 	void *user_data;
 };
@@ -671,7 +672,8 @@ static bool frame_watch_item_remove_by_handler(void *data, void *user_data)
 		l_container_of(data, struct frame_watch, super);
 	struct frame_watch_handler_check_info *info = user_data;
 
-	if (watch->super.notify != info->handler ||
+	if (watch->wdev_id != info->wdev_id ||
+			watch->super.notify != info->handler ||
 			watch->super.notify_data != info->user_data)
 		return false;
 
@@ -702,9 +704,9 @@ static bool frame_watch_remove_by_handler(uint64_t wdev_id, uint32_t group_id,
 						void *user_data)
 {
 	struct watch_group_match_info group_info =
-		{ wdev_id, group_id };
+		{ group_id == 0 ? 0 : wdev_id, group_id };
 	struct frame_watch_handler_check_info handler_info =
-		{ handler, user_data };
+		{ wdev_id, handler, user_data };
 	struct watch_group *group = l_queue_find(watch_groups,
 						frame_watch_group_match,
 						&group_info);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-04 14:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-31  0:56 [PATCH 1/2] frame-xchg: Fix frame_watch_remove_by_handler for group 0 Andrew Zaborowski
2020-05-31  0:56 ` [PATCH 2/2] frame-xchg: Use frame_watch_group_match in frame_watch_group_get Andrew Zaborowski
2020-06-04 14:19 ` [PATCH 1/2] frame-xchg: Fix frame_watch_remove_by_handler for group 0 Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox