Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

wifi: mac80211: Get the correct interface for non-netdev skb status

The function ieee80211_sdata_from_skb() always returned the P2P Device
interface in case the skb was not associated with a netdev and didn't
consider the possibility that an NAN Device interface is also enabled.

To support configurations where both P2P Device and a NAN Device
interface are active, extend the function to match the correct
interface based on address 2 in the 802.11 MAC header.

Since the 'p2p_sdata' field in struct ieee80211_local is no longer
needed, remove it.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250908140015.5252d2579a49.Id4576531c6b2ad83c9498b708dc0ade6b0214fa8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Ilan Peer and committed by
Johannes Berg
c7b5355b 8f79d2f1

+20 -19
-2
net/mac80211/ieee80211_i.h
··· 1676 1676 struct idr ack_status_frames; 1677 1677 spinlock_t ack_status_lock; 1678 1678 1679 - struct ieee80211_sub_if_data __rcu *p2p_sdata; 1680 - 1681 1679 /* virtual monitor interface */ 1682 1680 struct ieee80211_sub_if_data __rcu *monitor_sdata; 1683 1681 struct ieee80211_chan_req monitor_chanreq;
+1 -15
net/mac80211/iface.c
··· 620 620 621 621 spin_unlock_bh(&sdata->u.nan.func_lock); 622 622 break; 623 - case NL80211_IFTYPE_P2P_DEVICE: 624 - /* relies on synchronize_rcu() below */ 625 - RCU_INIT_POINTER(local->p2p_sdata, NULL); 626 - fallthrough; 627 623 default: 628 624 wiphy_work_cancel(sdata->local->hw.wiphy, &sdata->work); 629 625 /* ··· 1410 1414 ieee80211_recalc_idle(local); 1411 1415 1412 1416 netif_carrier_on(dev); 1417 + list_add_tail_rcu(&sdata->u.mntr.list, &local->mon_list); 1413 1418 break; 1414 1419 default: 1415 1420 if (coming_up) { ··· 1472 1475 */ 1473 1476 ieee80211_set_wmm_default(&sdata->deflink, true, 1474 1477 sdata->vif.type != NL80211_IFTYPE_STATION); 1475 - } 1476 - 1477 - switch (sdata->vif.type) { 1478 - case NL80211_IFTYPE_P2P_DEVICE: 1479 - rcu_assign_pointer(local->p2p_sdata, sdata); 1480 - break; 1481 - case NL80211_IFTYPE_MONITOR: 1482 - list_add_tail_rcu(&sdata->u.mntr.list, &local->mon_list); 1483 - break; 1484 - default: 1485 - break; 1486 1478 } 1487 1479 1488 1480 /*
+19 -2
net/mac80211/status.c
··· 5 5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 6 6 * Copyright 2008-2010 Johannes Berg <johannes@sipsolutions.net> 7 7 * Copyright 2013-2014 Intel Mobile Communications GmbH 8 - * Copyright 2021-2024 Intel Corporation 8 + * Copyright 2021-2025 Intel Corporation 9 9 */ 10 10 11 11 #include <linux/export.h> ··· 572 572 ieee80211_sdata_from_skb(struct ieee80211_local *local, struct sk_buff *skb) 573 573 { 574 574 struct ieee80211_sub_if_data *sdata; 575 + struct ieee80211_hdr *hdr = (void *)skb->data; 575 576 576 577 if (skb->dev) { 577 578 list_for_each_entry_rcu(sdata, &local->interfaces, list) { ··· 586 585 return NULL; 587 586 } 588 587 589 - return rcu_dereference(local->p2p_sdata); 588 + list_for_each_entry_rcu(sdata, &local->interfaces, list) { 589 + switch (sdata->vif.type) { 590 + case NL80211_IFTYPE_P2P_DEVICE: 591 + break; 592 + case NL80211_IFTYPE_NAN: 593 + if (sdata->u.nan.started) 594 + break; 595 + fallthrough; 596 + default: 597 + continue; 598 + } 599 + 600 + if (ether_addr_equal(sdata->vif.addr, hdr->addr2)) 601 + return sdata; 602 + } 603 + 604 + return NULL; 590 605 } 591 606 592 607 static void ieee80211_report_ack_skb(struct ieee80211_local *local,