1. 09 Dec, 2016 3 commits
    • Johannes Berg's avatar
      cfg80211/mac80211: fix BSS leaks when abandoning assoc attempts · e6f462df
      Johannes Berg authored
      When mac80211 abandons an association attempt, it may free
      all the data structures, but inform cfg80211 and userspace
      about it only by sending the deauth frame it received, in
      which case cfg80211 has no link to the BSS struct that was
      used and will not cfg80211_unhold_bss() it.
      
      Fix this by providing a way to inform cfg80211 of this with
      the BSS entry passed, so that it can clean up properly, and
      use this ability in the appropriate places in mac80211.
      
      This isn't ideal: some code is more or less duplicated and
      tracing is missing. However, it's a fairly small change and
      it's thus easier to backport - cleanups can come later.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      e6f462df
    • Vamsi Krishna's avatar
      nl80211: Use different attrs for BSSID and random MAC addr in scan req · 2fa436b3
      Vamsi Krishna authored
      NL80211_ATTR_MAC was used to set both the specific BSSID to be scanned
      and the random MAC address to be used when privacy is enabled. When both
      the features are enabled, both the BSSID and the local MAC address were
      getting same value causing Probe Request frames to go with unintended
      DA. Hence, this has been fixed by using a different NL80211_ATTR_BSSID
      attribute to set the specific BSSID (which was the more recent addition
      in cfg80211) for a scan.
      
      Backwards compatibility with old userspace software is maintained to
      some extent by allowing NL80211_ATTR_MAC to be used to set the specific
      BSSID when scanning without enabling random MAC address use.
      
      Scanning with random source MAC address was introduced by commit
      ad2b26ab ("cfg80211: allow drivers to support random MAC addresses
      for scan") and the issue was introduced with the addition of the second
      user for the same attribute in commit 818965d3 ("cfg80211: Allow a
      scan request for a specific BSSID").
      
      Fixes: 818965d3 ("cfg80211: Allow a scan request for a specific BSSID")
      Signed-off-by: default avatarVamsi Krishna <vamsin@qti.qualcomm.com>
      Signed-off-by: default avatarJouni Malinen <jouni@qca.qualcomm.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      2fa436b3
    • Johannes Berg's avatar
      nl80211: fix logic inversion in start_nan() · eeb04a96
      Johannes Berg authored
      Arend inadvertently inverted the logic while converting to
      wdev_running(), fix that.
      
      Fixes: 73c7da3d ("cfg80211: add generic helper to check interface is running")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      eeb04a96
  2. 21 Nov, 2016 7 commits
  3. 20 Nov, 2016 4 commits
    • Alexey Dobriyan's avatar
      net: fix bogus cast in skb_pagelen() and use unsigned variables · c72d8cda
      Alexey Dobriyan authored
      1) cast to "int" is unnecessary:
         u8 will be promoted to int before decrementing,
         small positive numbers fit into "int", so their values won't be changed
         during promotion.
      
         Once everything is int including loop counters, signedness doesn't
         matter: 32-bit operations will stay 32-bit operations.
      
         But! Someone tried to make this loop smart by making everything of
         the same type apparently in an attempt to optimise it.
         Do the optimization, just differently.
         Do the cast where it matters. :^)
      
      2) frag size is unsigned entity and sum of fragments sizes is also
         unsigned.
      
      Make everything unsigned, leave no MOVSX instruction behind.
      
      	add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-4 (-4)
      	function                                     old     new   delta
      	skb_cow_data                                 835     834      -1
      	ip_do_fragment                              2549    2548      -1
      	ip6_fragment                                3130    3128      -2
      	Total: Before=154865032, After=154865028, chg -0.00%
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c72d8cda
    • Alexey Dobriyan's avatar
      netlink: smaller nla_attr_minlen table · 32d84cdc
      Alexey Dobriyan authored
      Length of a netlink attribute may be u16 but lengths of basic attributes
      are much smaller, so small we can save 16 bytes of .rodata and pocket
      change inside .text.
      
      16-bit is worse on x86-64 than 8-bit because of operand size override prefix.
      
      	add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-19 (-19)
      	function                                     old     new   delta
      	validate_nla                                 418     417      -1
      	nla_policy_len                                66      64      -2
      	nla_attr_minlen                               32      16     -16
      	Total: Before=154865051, After=154865032, chg -0.00%
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      32d84cdc
    • Alexey Dobriyan's avatar
      netlink: use "unsigned int" in nla_next() · 3b2c75d3
      Alexey Dobriyan authored
      ->nla_len is unsigned entity (it's length after all) and u16,
      thus it can't overflow when being aligned into int/unsigned int.
      
      (nlmsg_next has the same code, but I didn't yet convince myself
      it is correct to do so).
      
      There is pointer arithmetic in this function and offset being
      unsigned is better:
      
      	add/remove: 0/0 grow/shrink: 1/64 up/down: 5/-309 (-304)
      	function                                     old     new   delta
      	nl80211_set_wiphy                           1444    1449      +5
      	team_nl_cmd_options_set                      997     995      -2
      	tcf_em_tree_validate                         872     870      -2
      	switchdev_port_bridge_setlink                352     350      -2
      	switchdev_port_br_afspec                     312     310      -2
      	rtm_to_fib_config                            428     426      -2
      	qla4xxx_sysfs_ddb_set_param                 2193    2191      -2
      	qla4xxx_iface_set_param                     4470    4468      -2
      	ovs_nla_free_flow_actions                    152     150      -2
      	output_userspace                             518     516      -2
      		...
      	nl80211_set_reg                              654     649      -5
      	validate_scan_freqs                          148     142      -6
      	validate_linkmsg                             288     282      -6
      	nl80211_parse_connkeys                       489     483      -6
      	nlattr_set                                   231     224      -7
      	nf_tables_delsetelem                         267     260      -7
      	do_setlink                                  3416    3408      -8
      	netlbl_cipsov4_add_std                      1672    1659     -13
      	nl80211_parse_sched_scan                    2902    2888     -14
      	nl80211_trigger_scan                        1738    1720     -18
      	do_execute_actions                          2821    2738     -83
      	Total: Before=154865355, After=154865051, chg -0.00%
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3b2c75d3
    • Alexey Dobriyan's avatar
      net: make struct napi_alloc_cache::skb_count unsigned int · e0d7924a
      Alexey Dobriyan authored
      size_t is way too much for an integer not exceeding 64.
      
      Space savings: 10 bytes!
      
      	add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-10 (-10)
      	function                                     old     new   delta
      	napi_consume_skb                             165     163      -2
      	__kfree_skb_flush                             56      53      -3
      	__kfree_skb_defer                             97      92      -5
      	Total: Before=154865639, After=154865629, chg -0.00%
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e0d7924a
  4. 19 Nov, 2016 6 commits
  5. 18 Nov, 2016 20 commits