aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Zaborowski <andrew.zaborowski@intel.com>2020-02-07 12:39:13 +0100
committerDenis Kenzior <denkenz@gmail.com>2020-02-07 15:41:14 -0600
commit1896ac2d730d38b019c6bb77af8b39d335e9a584 (patch)
tree4ddca5df732d6f4cdf33ab582b53eee7b9856b3c
parent053c1ca2a28577e2d4b83b35caf5060999440703 (diff)
downloadiwd-1896ac2d730d38b019c6bb77af8b39d335e9a584.tar.gz
frame-xchg: Use both group_id and wdev_id when removing group
In frame_watch_group_remove I forgot to actually match the group to be removed by both wdev_id and group_id. group_ids are unique only in the scope of one wdev.
-rw-r--r--src/frame-xchg.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/frame-xchg.c b/src/frame-xchg.c
index 78ee913b0..d8f537f54 100644
--- a/src/frame-xchg.c
+++ b/src/frame-xchg.c
@@ -323,19 +323,24 @@ bool frame_watch_add(uint64_t wdev_id, uint32_t group_id, uint16_t frame_type,
return true;
}
+struct watch_group_match_info {
+ uint64_t wdev_id;
+ uint32_t id;
+};
+
static bool frame_watch_group_match(const void *a, const void *b)
{
const struct watch_group *group = a;
- uint32_t id = L_PTR_TO_UINT(b);
+ const struct watch_group_match_info *info = b;
- return group->id == id;
+ return group->wdev_id == info->wdev_id && group->id == info->id;
}
bool frame_watch_group_remove(uint64_t wdev_id, uint32_t group_id)
{
+ struct watch_group_match_info info = { wdev_id, group_id };
struct watch_group *group = l_queue_remove_if(watch_groups,
- frame_watch_group_match,
- L_UINT_TO_PTR(group_id));
+ frame_watch_group_match, &info);
if (!group)
return false;