1. 24 Jun, 2020 3 commits
  2. 23 Jun, 2020 34 commits
  3. 22 Jun, 2020 3 commits
    • Tuomas Tynkkynen's avatar
      usbnet: smsc95xx: Fix use-after-free after removal · b835a71e
      Tuomas Tynkkynen authored
      Syzbot reports an use-after-free in workqueue context:
      
      BUG: KASAN: use-after-free in mutex_unlock+0x19/0x40 kernel/locking/mutex.c:737
       mutex_unlock+0x19/0x40 kernel/locking/mutex.c:737
       __smsc95xx_mdio_read drivers/net/usb/smsc95xx.c:217 [inline]
       smsc95xx_mdio_read+0x583/0x870 drivers/net/usb/smsc95xx.c:278
       check_carrier+0xd1/0x2e0 drivers/net/usb/smsc95xx.c:644
       process_one_work+0x777/0xf90 kernel/workqueue.c:2274
       worker_thread+0xa8f/0x1430 kernel/workqueue.c:2420
       kthread+0x2df/0x300 kernel/kthread.c:255
      
      It looks like that smsc95xx_unbind() is freeing the structures that are
      still in use by the concurrently running workqueue callback. Thus switch
      to using cancel_delayed_work_sync() to ensure the work callback really
      is no longer active.
      
      Reported-by: syzbot+29dc7d4ae19b703ff947@syzkaller.appspotmail.com
      Signed-off-by: default avatarTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b835a71e
    • Ido Schimmel's avatar
      mlxsw: spectrum: Do not rely on machine endianness · f3fe412b
      Ido Schimmel authored
      The second commit cited below performed a cast of 'u32 buffsize' to
      '(u16 *)' when calling mlxsw_sp_port_headroom_8x_adjust():
      
      mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, (u16 *) &buffsize);
      
      Colin noted that this will behave differently on big endian
      architectures compared to little endian architectures.
      
      Fix this by following Colin's suggestion and have the function accept
      and return 'u32' instead of passing the current size by reference.
      
      Fixes: da382875 ("mlxsw: spectrum: Extend to support Spectrum-3 ASIC")
      Fixes: 60833d54 ("mlxsw: spectrum: Adjust headroom buffers for 8x ports")
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reported-by: default avatarColin Ian King <colin.king@canonical.com>
      Suggested-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f3fe412b
    • Dejin Zheng's avatar
      net: phy: smsc: fix printing too many logs · 6d61f483
      Dejin Zheng authored
      Commit 7ae7ad2f ("net: phy: smsc: use phy_read_poll_timeout()
      to simplify the code") will print a lot of logs as follows when Ethernet
      cable is not connected:
      
      [    4.473105] SMSC LAN8710/LAN8720 2188000.ethernet-1:00: lan87xx_read_status failed: -110
      
      When wait 640 ms for check ENERGYON bit, the timeout should not be
      regarded as an actual error and an error message also should not be
      printed. due to a hardware bug in LAN87XX device, it leads to unstable
      detection of plugging in Ethernet cable when LAN87xx is in Energy Detect
      Power-Down mode. the workaround for it involves, when the link is down,
      and at each read_status() call:
      
      - disable EDPD mode, forcing the PHY out of low-power mode
      - waiting 640ms to see if we have any energy detected from the media
      - re-enable entry to EDPD mode
      
      This is presumably enough to allow the PHY to notice that a cable is
      connected, and resume normal operations to negotiate with the partner.
      The problem is that when no media is detected, the 640ms wait times
      out and this commit was modified to prints an error message. it is an
      inappropriate conversion by used phy_read_poll_timeout() to introduce
      this bug. so fix this issue by use read_poll_timeout() to replace
      phy_read_poll_timeout().
      
      Fixes: 7ae7ad2f ("net: phy: smsc: use phy_read_poll_timeout() to simplify the code")
      Reported-by: default avatarKevin Groeneveld <kgroeneveld@gmail.com>
      Signed-off-by: default avatarDejin Zheng <zhengdejin5@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6d61f483