1. 29 6月, 2017 2 次提交
  2. 16 6月, 2017 1 次提交
    • J
      networking: introduce and use skb_put_data() · 59ae1d12
      Johannes Berg 提交于
      A common pattern with skb_put() is to just want to memcpy()
      some data into the new space, introduce skb_put_data() for
      this.
      
      An spatch similar to the one for skb_put_zero() converts many
      of the places using it:
      
          @@
          identifier p, p2;
          expression len, skb, data;
          type t, t2;
          @@
          (
          -p = skb_put(skb, len);
          +p = skb_put_data(skb, data, len);
          |
          -p = (t)skb_put(skb, len);
          +p = skb_put_data(skb, data, len);
          )
          (
          p2 = (t2)p;
          -memcpy(p2, data, len);
          |
          -memcpy(p, data, len);
          )
      
          @@
          type t, t2;
          identifier p, p2;
          expression skb, data;
          @@
          t *p;
          ...
          (
          -p = skb_put(skb, sizeof(t));
          +p = skb_put_data(skb, data, sizeof(t));
          |
          -p = (t *)skb_put(skb, sizeof(t));
          +p = skb_put_data(skb, data, sizeof(t));
          )
          (
          p2 = (t2)p;
          -memcpy(p2, data, sizeof(*p));
          |
          -memcpy(p, data, sizeof(*p));
          )
      
          @@
          expression skb, len, data;
          @@
          -memcpy(skb_put(skb, len), data, len);
          +skb_put_data(skb, data, len);
      
      (again, manually post-processed to retain some comments)
      Reviewed-by: NStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      59ae1d12
  3. 13 6月, 2017 1 次提交
  4. 19 5月, 2017 1 次提交
    • B
      mwifiex: fixup error cases in mwifiex_add_virtual_intf() · 8535107a
      Brian Norris 提交于
      If we fail to add an interface in mwifiex_add_virtual_intf(), we might
      hit a BUG_ON() in the networking code, because we didn't tear things
      down properly. Among the problems:
      
       (a) when failing to allocate workqueues, we fail to unregister the
           netdev before calling free_netdev()
       (b) even if we do try to unregister the netdev, we're still holding the
           rtnl lock, so the device never properly unregistered; we'll be at
           state NETREG_UNREGISTERING, and then hit free_netdev()'s:
      	BUG_ON(dev->reg_state != NETREG_UNREGISTERED);
       (c) we're allocating some dependent resources (e.g., DFS workqueues)
           after we've registered the interface; this may or may not cause
           problems, but it's good practice to allocate these before registering
       (d) we're not even trying to unwind anything when mwifiex_send_cmd() or
           mwifiex_sta_init_cmd() fail
      
      To fix these issues, let's:
      
       * add a stacked set of error handling labels, to keep error handling
         consistent and properly ordered (resolving (a) and (d))
       * move the workqueue allocations before the registration (to resolve
         (c); also resolves (b) by avoiding error cases where we have to
         unregister)
      
      [Incidentally, it's pretty easy to interrupt the alloc_workqueue() in,
      e.g., the following:
      
        iw phy phy0 interface add mlan0 type station
      
      by sending it SIGTERM.]
      
      This bugfix covers commits like commit 7d652034 ("mwifiex: channel
      switch support for mwifiex"), but parts of this bug exist all the way
      back to the introduction of dynamic interface handling in commit
      93a1df48 ("mwifiex: add cfg80211 handlers add/del_virtual_intf").
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NBrian Norris <briannorris@chromium.org>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      8535107a
  5. 28 4月, 2017 1 次提交
  6. 27 4月, 2017 2 次提交
  7. 20 4月, 2017 1 次提交
    • B
      mwifiex: MAC randomization should not be persistent · 7e2f18f0
      Brian Norris 提交于
      nl80211 provides the NL80211_SCAN_FLAG_RANDOM_ADDR for every scan
      request that should be randomized; the absence of such a flag means we
      should not randomize. However, mwifiex was stashing the latest
      randomization request and *always* using it for future scans, even those
      that didn't set the flag.
      
      Let's zero out the randomization info whenever we get a scan request
      without NL80211_SCAN_FLAG_RANDOM_ADDR. I'd prefer to remove
      priv->random_mac entirely (and plumb the randomization MAC properly
      through the call sequence), but the spaghetti is a little difficult to
      unravel here for me.
      
      Fixes: c2a8f0ff ("mwifiex: support random MAC address for scanning")
      Cc: <stable@vger.kernel.org> # 4.9+
      Signed-off-by: NBrian Norris <briannorris@chromium.org>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      7e2f18f0
  8. 14 4月, 2017 1 次提交
  9. 13 4月, 2017 1 次提交
  10. 05 4月, 2017 1 次提交
  11. 13 12月, 2016 1 次提交
  12. 29 11月, 2016 1 次提交
  13. 25 11月, 2016 1 次提交
  14. 17 11月, 2016 1 次提交
  15. 09 11月, 2016 3 次提交
  16. 26 9月, 2016 1 次提交
  17. 15 9月, 2016 1 次提交
  18. 09 9月, 2016 1 次提交
  19. 03 9月, 2016 3 次提交
  20. 19 7月, 2016 1 次提交
  21. 08 7月, 2016 3 次提交
    • A
      mwifiex: fix scan_block flag handling · b74d6e74
      Amitkumar Karwar 提交于
      scan_block flag is used to block scan operation when 4 way handshake
      is in progress. Sometimes it doesn't get cleared due to incomplete
      association. An example is assoc request/response is done, but add key
      operation get canceled in some corner cases. As a result, further
      association/scan operations are blocked.
      
      This patch fixes the problem by clearing scan_block flag.
      Signed-off-by: NAmitkumar Karwar <akarwar@marvell.com>
      Signed-off-by: NXinming Hu <huxm@marvell.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      b74d6e74
    • A
      mwifiex: fix NULL pointer dereference during suspend · 16d25da9
      Amitkumar Karwar 提交于
      This patch fixes below NULL pointer dereference observed in suspend
      stress test. When scan is cancelled during system suspend, we may end
      up aceesing "priv->scan_request" in corner case.
      
      [ 3035.304682] BUG: KASAN: null-ptr-deref on address 0000000000000008
      [ 3035.304704] Read of size 4 by task ksdioirqd/mmc2/1183
      [ 3035.304744] CPU: 0 PID: 1183 Comm: ksdioirqd/mmc2 Tainted: G        W      3.18.0 #1169
      [ 3035.304772] Call trace:
      [ 3035.304825] [<ffffffc00020a520>] dump_backtrace+0x0/0x190
      [ 3035.304864] [<ffffffc00020a6cc>] show_stack+0x1c/0x28
      [ 3035.304901] [<ffffffc000b36db8>] dump_stack+0xa0/0xf8
      [ 3035.304940] [<ffffffc00039c494>] kasan_report+0x120/0x4fc
      [ 3035.304975] [<ffffffc00039b6b4>] __asan_load4+0x20/0x80
      [ 3035.305546] [<ffffffbffc1f5aec>] mwifiex_check_next_scan_command+0x1a4/0x588 [mwifiex]
      [ 3035.306091] [<ffffffbffc1f7aec>] mwifiex_handle_event_ext_scan_report+0x304/0x370 [mwifiex]
      [ 3035.306735] [<ffffffbffc206bb8>] mwifiex_process_sta_event+0x6c0/0xf10 [mwifiex]
      [ 3035.307200] [<ffffffbffc1e609c>] mwifiex_process_event+0x2f4/0x358 [mwifiex]
      [ 3035.307612] [<ffffffbffc1e25c8>] mwifiex_main_process+0x3cc/0x80c [mwifiex]
      [ 3035.307737] [<ffffffbffc2523a0>] mwifiex_sdio_interrupt+0x198/0x1c0 [mwifiex_sdio]
      [ 3035.307785] [<ffffffc0008d9250>] process_sdio_pending_irqs+0x15c/0x1d4
      [ 3035.307826] [<ffffffc0008d93f0>] sdio_irq_thread+0xd8/0x288
      Signed-off-by: NAmitkumar Karwar <akarwar@marvell.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      16d25da9
    • A
      mwifiex: code rearrangement in suspend handler · 322397b2
      Amitkumar Karwar 提交于
      We will derive sta_priv at the beginning of suspend handler.
      This will be useful for next patch in this series.
      Signed-off-by: NAmitkumar Karwar <akarwar@marvell.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      322397b2
  22. 05 7月, 2016 3 次提交
    • S
      mwifiex: add get_antenna support for cfg80211 · 3ee71285
      Shengzhen Li 提交于
      Since commit de3bb771 ("cfg80211: add more warnings for inconsistent
      ops") the wireless core warns if a driver implements a cfg80211 callback
      but doesn't implements the inverse operation.
      
      The mwifiex driver defines a .set_antenna handler but not a .get_antenna
      so this not only makes the core to print a warning when creating a new
      wiphy but also the antenna isn't reported to user-space apps such as iw.
      
      This patch queries the antenna to the firmware so is properly reported to
      user-space. With this patch, the wireless core does not warn anymore and:
      
      $ iw phy phy0 info | grep Antennas
              Available Antennas: TX 0x3 RX 0x3
              Configured Antennas: TX 0x3 RX 0x3
      Signed-off-by: NShengzhen Li <szli@marvell.com>
      Signed-off-by: NAmitkumar Karwar <akarwar@marvell.com>
      [javier: expand the commit message]
      Signed-off-by: NJavier Martinez Canillas <javier@osg.samsung.com>
      Tested-by: NEnric Balletbo i Serra <enric.balletbo@collabora.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      3ee71285
    • J
      mwifiex: add a cfg80211 .get_tx_power operation callback · 7d54baca
      Javier Martinez Canillas 提交于
      The mwifiex driver implements a cfg80211 .set_tx_power operation handler
      but doesn't have the inverse .get_tx_power callback.
      
      This not only has the effect that the Tx power can't be reported to user
      space tools such as iwconfig and iwlist but also that the wireless core
      prints a warning when a new wiphy is created due an cfg80211 operation
      being implemented without its counterpart.
      
      After this patch, the Tx power is properly reported to user-space tools:
      
      $ iwlist mlan0 txpower
      mlan0     unknown transmit-power information.
      
                Current Tx-Power=13 dBm       (19 mW)
      
      and also the following warning isn't shown anymore on the driver probe:
      
      WARNING: CPU: 3 PID: 127 at net/wireless/core.c:366 wiphy_new_nm+0x66c/0x6ac
      Modules linked in: mwifiex_sdio mwifiex
      CPU: 3 PID: 127 Comm: kworker/3:1 Tainted: G        W       4.7.0-rc1-next-20160531-00006-g569df5b983f3
      Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      Workqueue: events request_firmware_work_func
      [<c010e1ac>] (unwind_backtrace) from [<c010af38>] (show_stack+0x10/0x14)
      [<c010af38>] (show_stack) from [<c0323b9c>] (dump_stack+0x88/0x9c)
      [<c0323b9c>] (dump_stack) from [<c011a828>] (__warn+0xe8/0x100)
      [<c011a828>] (__warn) from [<c011a8f0>] (warn_slowpath_null+0x20/0x28)
      [<c011a8f0>] (warn_slowpath_null) from [<c06a42d4>] (wiphy_new_nm+0x66c/0x6ac)
      [<c06a42d4>] (wiphy_new_nm) from [<bf1c24cc>] (mwifiex_register_cfg80211+0x28/0x3f0 [mwifiex])
      [<bf1c24cc>] (mwifiex_register_cfg80211 [mwifiex]) from [<bf1a0018>] (mwifiex_fw_dpc+0x2b0/0x474 [mwifiex])
      [<bf1a0018>] (mwifiex_fw_dpc [mwifiex]) from [<c040eb74>] (request_firmware_work_func+0x30/0x58)
      [<c040eb74>] (request_firmware_work_func) from [<c012fe90>] (process_one_work+0x124/0x338)
      [<c012fe90>] (process_one_work) from [<c01300dc>] (worker_thread+0x38/0x4d4)
      [<c01300dc>] (worker_thread) from [<c01353b8>] (kthread+0xdc/0xf4)
      [<c01353b8>] (kthread) from [<c0107978>] (ret_from_fork+0x14/0x3c)
      Signed-off-by: NJavier Martinez Canillas <javier@osg.samsung.com>
      Tested-by: NEnric Balletbo i Serra <enric.balletbo@collabora.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      7d54baca
    • J
      mwifiex: fix unconditional error return in .add_virtual_intf callback · f152bdad
      Javier Martinez Canillas 提交于
      The commit 7311ea85 ("mwifiex: fix AP start problem for newly added
      interface") attempted to fix an issue when a new AP interface is added.
      
      But the patch didn't check the return value of the functions doing the
      firmware calls and returned an error even if the functions didn't fail.
      
      This prevents the network device to be registered properly, so fix it.
      
      Fixes: 7311ea85 ("mwifiex: fix AP start problem for newly added interface")
      Signed-off-by: NJavier Martinez Canillas <javier@osg.samsung.com>
      Reviewed-by: NJulian Calaby <julian.calaby@gmail.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      f152bdad
  23. 29 6月, 2016 2 次提交
  24. 27 4月, 2016 3 次提交
  25. 12 4月, 2016 1 次提交
  26. 08 4月, 2016 2 次提交