1. 13 9月, 2018 1 次提交
  2. 03 9月, 2018 1 次提交
    • J
      net: cadence: Fix a sleep-in-atomic-context bug in macb_halt_tx() · 16fe10cf
      Jia-Ju Bai 提交于
      The kernel module may sleep with holding a spinlock.
      
      The function call paths (from bottom to top) in Linux-4.16 are:
      
      [FUNC] usleep_range
      drivers/net/ethernet/cadence/macb_main.c, 648:
      	usleep_range in macb_halt_tx
      drivers/net/ethernet/cadence/macb_main.c, 730:
      	macb_halt_tx in macb_tx_error_task
      drivers/net/ethernet/cadence/macb_main.c, 721:
      	_raw_spin_lock_irqsave in macb_tx_error_task
      
      To fix this bug, usleep_range() is replaced with udelay().
      
      This bug is found by my static analysis tool DSAC.
      Signed-off-by: NJia-Ju Bai <baijiaju1990@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      16fe10cf
  3. 26 8月, 2018 2 次提交
    • A
      net: macb: do not disable MDIO bus at open/close time · 0da70f80
      Anssi Hannula 提交于
      macb_reset_hw() is called from macb_close() and indirectly from
      macb_open(). macb_reset_hw() zeroes the NCR register, including the MPE
      (Management Port Enable) bit.
      
      This will prevent accessing any other PHYs for other Ethernet MACs on
      the MDIO bus, which remains registered at macb_reset_hw() time, until
      macb_init_hw() is called from macb_open() which sets the MPE bit again.
      
      I.e. currently the MDIO bus has a short disruption at open time and is
      disabled at close time until the interface is opened again.
      
      Fix that by only touching the RE and TE bits when enabling and disabling
      RX/TX.
      
      v2: Make macb_init_hw() NCR write a single statement.
      
      Fixes: 6c36a707 ("macb: Use generic PHY layer")
      Signed-off-by: NAnssi Hannula <anssi.hannula@bitwise.fi>
      Reviewed-by: NClaudiu Beznea <claudiu.beznea@microchip.com>
      Tested-by: NClaudiu Beznea <claudiu.beznea@microchip.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0da70f80
    • A
      net: macb: Fix regression breaking non-MDIO fixed-link PHYs · ab5f1105
      Ahmad Fatoum 提交于
      commit 739de9a1 ("net: macb: Reorganize macb_mii bringup") broke
      initializing macb on the EVB-KSZ9477 eval board.
      There, of_mdiobus_register was called even for the fixed-link representing
      the RGMII-link to the switch with the result that the driver attempts to
      enumerate PHYs on a non-existent MDIO bus:
      
      	libphy: MACB_mii_bus: probed
      	mdio_bus f0028000.ethernet-ffffffff: fixed-link has invalid PHY address
      	mdio_bus f0028000.ethernet-ffffffff: scan phy fixed-link at address 0
              [snip]
      	mdio_bus f0028000.ethernet-ffffffff: scan phy fixed-link at address 31
      
      The "MDIO" bus registration succeeds regardless, having claimed the reset GPIO,
      and calling of_phy_register_fixed_link later on fails because it tries
      to claim the same GPIO:
      
      	macb f0028000.ethernet: broken fixed-link specification
      
      Fix this by registering the fixed-link before calling mdiobus_register.
      
      Fixes: 739de9a1 ("net: macb: Reorganize macb_mii bringup")
      Signed-off-by: NAhmad Fatoum <a.fatoum@pengutronix.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ab5f1105
  4. 08 8月, 2018 3 次提交
  5. 07 7月, 2018 2 次提交
  6. 28 6月, 2018 1 次提交
    • A
      net: macb: initialize bp->queues[0].bp for at91rm9200 · fec9d3b1
      Alexandre Belloni 提交于
      The macb driver currently crashes on at91rm9200 with the following trace:
      
      Unable to handle kernel NULL pointer dereference at virtual address 00000014
      [...]
      [<c031da44>] (macb_rx_desc) from [<c031f2bc>] (at91ether_open+0x2e8/0x3f8)
      [<c031f2bc>] (at91ether_open) from [<c041e8d8>] (__dev_open+0x120/0x13c)
      [<c041e8d8>] (__dev_open) from [<c041ec08>] (__dev_change_flags+0x17c/0x1a8)
      [<c041ec08>] (__dev_change_flags) from [<c041ec4c>] (dev_change_flags+0x18/0x4c)
      [<c041ec4c>] (dev_change_flags) from [<c07a5f4c>] (ip_auto_config+0x220/0x10b0)
      [<c07a5f4c>] (ip_auto_config) from [<c000a4fc>] (do_one_initcall+0x78/0x18c)
      [<c000a4fc>] (do_one_initcall) from [<c0783e50>] (kernel_init_freeable+0x184/0x1c4)
      [<c0783e50>] (kernel_init_freeable) from [<c0574d70>] (kernel_init+0x8/0xe8)
      [<c0574d70>] (kernel_init) from [<c00090e0>] (ret_from_fork+0x14/0x34)
      
      Solve that by initializing bp->queues[0].bp in at91ether_init (as is done
      in macb_init).
      
      Fixes: ae1f2a56 ("net: macb: Added support for many RX queues")
      Signed-off-by: NAlexandre Belloni <alexandre.belloni@bootlin.com>
      Acked-by: NNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fec9d3b1
  7. 17 5月, 2018 1 次提交
  8. 30 3月, 2018 1 次提交
  9. 16 3月, 2018 3 次提交
  10. 30 1月, 2018 1 次提交
  11. 06 12月, 2017 5 次提交
  12. 01 12月, 2017 3 次提交
  13. 11 11月, 2017 2 次提交
  14. 01 11月, 2017 1 次提交
  15. 18 7月, 2017 1 次提交
  16. 08 7月, 2017 1 次提交
  17. 05 7月, 2017 1 次提交
  18. 01 7月, 2017 3 次提交
  19. 26 6月, 2017 1 次提交
  20. 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
  21. 01 5月, 2017 1 次提交
  22. 07 4月, 2017 1 次提交
  23. 28 2月, 2017 1 次提交
  24. 31 1月, 2017 1 次提交
  25. 30 1月, 2017 1 次提交