Only a few fixes:

* always keep regulatory user hint
  * add missing break statement in station flags parsing
  * fix non-linear SKBs in port-control-over-nl80211
  * reconfigure VLAN stations during HW restart
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEH1e1rEeCd0AIMq6MB8qZga/fl8QFAltW0eYACgkQB8qZga/f
 l8SXvQ/5AYXK9qZuwhxIdJ5zpgcidDiWMl+aoaWeAdQF+giDTyB+tiZ7GyIYeJca
 +4OJoC90DEH9Yq835rNIYXqGkcT12vSwJgaBp79hx0ch3ufwZqBepdX8DcCd0+18
 NAP8IlRoSiGZ/GlpNxYCkXFMUEoRSxvbk4BXowlDwiN/h4ziCRnUkD1OaL6mqHsI
 XTRjVRTQCekurc1o74s4kGX3Nj2ir3JJEGaD9Ha5Jsc18OQxx2fs5fgaGl3ffJaR
 vJTiqvPPAvdymeV/S+J9BoCe8xAgO7Z0EDC3tbB7rlZ629XEJp9L91s2EN1Od8m3
 k1pxq+nT4pci5UVnRtlAyHrr06VxhIYCRBRc+qvjXOTDIkEVF1UEQH9RExi4XNp5
 OmcdXQ7fc1UhQfzy4vkM5EQamaxgJzAWZ9SGRIf4RmpUcux4ZTRDjoclwEkATXqr
 C2lxDuIkHtClqY9BL+0f2TEio1drEawf99iWD4bSmRL+gng5LK8yxm0rAKFrnG81
 kNfxb9Qg4OyJhl0764u2pDyK9YErFNPnxHEsNBCD3DT4Q/9yKIZzmgi4GJKZyWYe
 x09+1zFsS/xtg2n0SOaYlLtPNPAKC7AkLqZ+FtHreIjVbKTgW+dEgniscQdUAfYT
 nY09uPzbabEyNaF/fuZCOofu3YignVLWlr6Z+PG1sIKqp6qaPQY=
 =qtIc
 -----END PGP SIGNATURE-----

Merge tag 'mac80211-for-davem-2018-07-24' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211

Johannes Berg says:

====================
Only a few fixes:
 * always keep regulatory user hint
 * add missing break statement in station flags parsing
 * fix non-linear SKBs in port-control-over-nl80211
 * reconfigure VLAN stations during HW restart
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2018-07-24 09:38:50 -07:00
commit e1adf31471
6 changed files with 38 additions and 53 deletions

View File

@ -5835,10 +5835,11 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
/** /**
* cfg80211_rx_control_port - notification about a received control port frame * cfg80211_rx_control_port - notification about a received control port frame
* @dev: The device the frame matched to * @dev: The device the frame matched to
* @buf: control port frame * @skb: The skbuf with the control port frame. It is assumed that the skbuf
* @len: length of the frame data * is 802.3 formatted (with 802.3 header). The skb can be non-linear.
* @addr: The peer from which the frame was received * This function does not take ownership of the skb, so the caller is
* @proto: frame protocol, typically PAE or Pre-authentication * responsible for any cleanup. The caller must also ensure that
* skb->protocol is set appropriately.
* @unencrypted: Whether the frame was received unencrypted * @unencrypted: Whether the frame was received unencrypted
* *
* This function is used to inform userspace about a received control port * This function is used to inform userspace about a received control port
@ -5851,8 +5852,7 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
* Return: %true if the frame was passed to userspace * Return: %true if the frame was passed to userspace
*/ */
bool cfg80211_rx_control_port(struct net_device *dev, bool cfg80211_rx_control_port(struct net_device *dev,
const u8 *buf, size_t len, struct sk_buff *skb, bool unencrypted);
const u8 *addr, u16 proto, bool unencrypted);
/** /**
* cfg80211_cqm_rssi_notify - connection quality monitoring rssi event * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event

View File

@ -2254,11 +2254,8 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb,
sdata->control_port_over_nl80211)) { sdata->control_port_over_nl80211)) {
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
bool noencrypt = status->flag & RX_FLAG_DECRYPTED; bool noencrypt = status->flag & RX_FLAG_DECRYPTED;
struct ethhdr *ehdr = eth_hdr(skb);
cfg80211_rx_control_port(dev, skb->data, skb->len, cfg80211_rx_control_port(dev, skb, noencrypt);
ehdr->h_source,
be16_to_cpu(skb->protocol), noencrypt);
dev_kfree_skb(skb); dev_kfree_skb(skb);
} else { } else {
/* deliver to local stack */ /* deliver to local stack */

View File

@ -2111,7 +2111,8 @@ int ieee80211_reconfig(struct ieee80211_local *local)
if (!sta->uploaded) if (!sta->uploaded)
continue; continue;
if (sta->sdata->vif.type != NL80211_IFTYPE_AP) if (sta->sdata->vif.type != NL80211_IFTYPE_AP &&
sta->sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
continue; continue;
for (state = IEEE80211_STA_NOTEXIST; for (state = IEEE80211_STA_NOTEXIST;

View File

@ -4409,6 +4409,7 @@ static int parse_station_flags(struct genl_info *info,
params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHENTICATED) | params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHENTICATED) |
BIT(NL80211_STA_FLAG_MFP) | BIT(NL80211_STA_FLAG_MFP) |
BIT(NL80211_STA_FLAG_AUTHORIZED); BIT(NL80211_STA_FLAG_AUTHORIZED);
break;
default: default:
return -EINVAL; return -EINVAL;
} }
@ -14923,20 +14924,24 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
EXPORT_SYMBOL(cfg80211_mgmt_tx_status); EXPORT_SYMBOL(cfg80211_mgmt_tx_status);
static int __nl80211_rx_control_port(struct net_device *dev, static int __nl80211_rx_control_port(struct net_device *dev,
const u8 *buf, size_t len, struct sk_buff *skb,
const u8 *addr, u16 proto,
bool unencrypted, gfp_t gfp) bool unencrypted, gfp_t gfp)
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
struct ethhdr *ehdr = eth_hdr(skb);
const u8 *addr = ehdr->h_source;
u16 proto = be16_to_cpu(skb->protocol);
struct sk_buff *msg; struct sk_buff *msg;
void *hdr; void *hdr;
struct nlattr *frame;
u32 nlportid = READ_ONCE(wdev->conn_owner_nlportid); u32 nlportid = READ_ONCE(wdev->conn_owner_nlportid);
if (!nlportid) if (!nlportid)
return -ENOENT; return -ENOENT;
msg = nlmsg_new(100 + len, gfp); msg = nlmsg_new(100 + skb->len, gfp);
if (!msg) if (!msg)
return -ENOMEM; return -ENOMEM;
@ -14950,13 +14955,17 @@ static int __nl80211_rx_control_port(struct net_device *dev,
nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) ||
nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev), nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
NL80211_ATTR_PAD) || NL80211_ATTR_PAD) ||
nla_put(msg, NL80211_ATTR_FRAME, len, buf) ||
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) || nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) ||
nla_put_u16(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE, proto) || nla_put_u16(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE, proto) ||
(unencrypted && nla_put_flag(msg, (unencrypted && nla_put_flag(msg,
NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT))) NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT)))
goto nla_put_failure; goto nla_put_failure;
frame = nla_reserve(msg, NL80211_ATTR_FRAME, skb->len);
if (!frame)
goto nla_put_failure;
skb_copy_bits(skb, 0, nla_data(frame), skb->len);
genlmsg_end(msg, hdr); genlmsg_end(msg, hdr);
return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid);
@ -14967,14 +14976,12 @@ static int __nl80211_rx_control_port(struct net_device *dev,
} }
bool cfg80211_rx_control_port(struct net_device *dev, bool cfg80211_rx_control_port(struct net_device *dev,
const u8 *buf, size_t len, struct sk_buff *skb, bool unencrypted)
const u8 *addr, u16 proto, bool unencrypted)
{ {
int ret; int ret;
trace_cfg80211_rx_control_port(dev, buf, len, addr, proto, unencrypted); trace_cfg80211_rx_control_port(dev, skb, unencrypted);
ret = __nl80211_rx_control_port(dev, buf, len, addr, proto, ret = __nl80211_rx_control_port(dev, skb, unencrypted, GFP_ATOMIC);
unencrypted, GFP_ATOMIC);
trace_cfg80211_return_bool(ret == 0); trace_cfg80211_return_bool(ret == 0);
return ret == 0; return ret == 0;
} }

View File

@ -2240,7 +2240,9 @@ static void wiphy_update_regulatory(struct wiphy *wiphy,
* as some drivers used this to restore its orig_* reg domain. * as some drivers used this to restore its orig_* reg domain.
*/ */
if (initiator == NL80211_REGDOM_SET_BY_CORE && if (initiator == NL80211_REGDOM_SET_BY_CORE &&
wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) wiphy->regulatory_flags & REGULATORY_CUSTOM_REG &&
!(wiphy->regulatory_flags &
REGULATORY_WIPHY_SELF_MANAGED))
reg_call_notifier(wiphy, lr); reg_call_notifier(wiphy, lr);
return; return;
} }
@ -2787,26 +2789,6 @@ static void notify_self_managed_wiphys(struct regulatory_request *request)
} }
} }
static bool reg_only_self_managed_wiphys(void)
{
struct cfg80211_registered_device *rdev;
struct wiphy *wiphy;
bool self_managed_found = false;
ASSERT_RTNL();
list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
wiphy = &rdev->wiphy;
if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)
self_managed_found = true;
else
return false;
}
/* make sure at least one self-managed wiphy exists */
return self_managed_found;
}
/* /*
* Processes regulatory hints, this is all the NL80211_REGDOM_SET_BY_* * Processes regulatory hints, this is all the NL80211_REGDOM_SET_BY_*
* Regulatory hints come on a first come first serve basis and we * Regulatory hints come on a first come first serve basis and we
@ -2839,10 +2821,6 @@ static void reg_process_pending_hints(void)
spin_unlock(&reg_requests_lock); spin_unlock(&reg_requests_lock);
notify_self_managed_wiphys(reg_request); notify_self_managed_wiphys(reg_request);
if (reg_only_self_managed_wiphys()) {
reg_free_request(reg_request);
return;
}
reg_process_hint(reg_request); reg_process_hint(reg_request);

View File

@ -2627,23 +2627,25 @@ TRACE_EVENT(cfg80211_mgmt_tx_status,
); );
TRACE_EVENT(cfg80211_rx_control_port, TRACE_EVENT(cfg80211_rx_control_port,
TP_PROTO(struct net_device *netdev, const u8 *buf, size_t len, TP_PROTO(struct net_device *netdev, struct sk_buff *skb,
const u8 *addr, u16 proto, bool unencrypted), bool unencrypted),
TP_ARGS(netdev, buf, len, addr, proto, unencrypted), TP_ARGS(netdev, skb, unencrypted),
TP_STRUCT__entry( TP_STRUCT__entry(
NETDEV_ENTRY NETDEV_ENTRY
MAC_ENTRY(addr) __field(int, len)
MAC_ENTRY(from)
__field(u16, proto) __field(u16, proto)
__field(bool, unencrypted) __field(bool, unencrypted)
), ),
TP_fast_assign( TP_fast_assign(
NETDEV_ASSIGN; NETDEV_ASSIGN;
MAC_ASSIGN(addr, addr); __entry->len = skb->len;
__entry->proto = proto; MAC_ASSIGN(from, eth_hdr(skb)->h_source);
__entry->proto = be16_to_cpu(skb->protocol);
__entry->unencrypted = unencrypted; __entry->unencrypted = unencrypted;
), ),
TP_printk(NETDEV_PR_FMT ", " MAC_PR_FMT " proto: 0x%x, unencrypted: %s", TP_printk(NETDEV_PR_FMT ", len=%d, " MAC_PR_FMT ", proto: 0x%x, unencrypted: %s",
NETDEV_PR_ARG, MAC_PR_ARG(addr), NETDEV_PR_ARG, __entry->len, MAC_PR_ARG(from),
__entry->proto, BOOL_TO_STR(__entry->unencrypted)) __entry->proto, BOOL_TO_STR(__entry->unencrypted))
); );