1. 18 Nov, 2016 10 commits
    • WANG Cong's avatar
      af_unix: conditionally use freezable blocking calls in read · 06a77b07
      WANG Cong authored
      Commit 2b15af6f ("af_unix: use freezable blocking calls in read")
      converts schedule_timeout() to its freezable version, it was probably
      correct at that time, but later, commit 2b514574
      ("net: af_unix: implement splice for stream af_unix sockets") breaks
      the strong requirement for a freezable sleep, according to
      commit 0f9548ca:
      
          We shouldn't try_to_freeze if locks are held.  Holding a lock can cause a
          deadlock if the lock is later acquired in the suspend or hibernate path
          (e.g.  by dpm).  Holding a lock can also cause a deadlock in the case of
          cgroup_freezer if a lock is held inside a frozen cgroup that is later
          acquired by a process outside that group.
      
      The pipe_lock is still held at that point.
      
      So use freezable version only for the recvmsg call path, avoid impact for
      Android.
      
      Fixes: 2b514574 ("net: af_unix: implement splice for stream af_unix sockets")
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Colin Cross <ccross@android.com>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      06a77b07
    • David S. Miller's avatar
      Merge branch 'cpsw-fixes' · 0e2d1af3
      David S. Miller authored
      Johan Hovold says:
      
      ====================
      net: cpsw: fix leaks and probe deferral
      
      This series fixes as number of leaks and issues in the cpsw probe-error
      and driver-unbind paths, some which specifically prevented deferred
      probing.
      
      v2
       - Keep platform device runtime-resumed throughout probe instead of
         resuming in the probe error path as suggested by Grygorii (patch
         1/7).
      
       - Runtime-resume platform device before registering any children in
         order to make sure it is synchronously suspended after deregistering
         children in the error path (patch 3/7).
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0e2d1af3
    • Johan Hovold's avatar
      net: ethernet: ti: cpsw: fix fixed-link phy probe deferral · 23a09873
      Johan Hovold authored
      Make sure to propagate errors from of_phy_register_fixed_link() which
      can fail with -EPROBE_DEFER.
      
      Fixes: 1f71e8c9 ("drivers: net: cpsw: Add support for fixed-link
      PHY")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      23a09873
    • Johan Hovold's avatar
      net: ethernet: ti: cpsw: add missing sanity check · 3420ea88
      Johan Hovold authored
      Make sure to check for allocation failures before dereferencing a
      NULL-pointer during probe.
      
      Fixes: 649a1688 ("net: ethernet: ti: cpsw: create common struct to
      hold shared driver data")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3420ea88
    • Johan Hovold's avatar
      net: ethernet: ti: cpsw: fix secondary-emac probe error path · a7fe9d46
      Johan Hovold authored
      Make sure to deregister the primary device in case the secondary emac
      fails to probe.
      
      kernel BUG at /home/johan/work/omicron/src/linux/net/core/dev.c:7743!
      ...
      [<c05b3dec>] (free_netdev) from [<c04fe6c0>] (cpsw_probe+0x9cc/0xe50)
      [<c04fe6c0>] (cpsw_probe) from [<c047b28c>] (platform_drv_probe+0x5c/0xc0)
      
      Fixes: d9ba8f9e ("driver: net: ethernet: cpsw: dual emac interface
      implementation")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a7fe9d46
    • Johan Hovold's avatar
      net: ethernet: ti: cpsw: fix of_node and phydev leaks · 8cbcc466
      Johan Hovold authored
      Make sure to drop references taken and deregister devices registered
      during probe on probe errors (including deferred probe) and driver
      unbind.
      
      Specifically, PHY of-node references were never released and fixed-link
      PHY devices were never deregistered.
      
      Fixes: 9e42f715 ("drivers: net: cpsw: add phy-handle parsing")
      Fixes: 1f71e8c9 ("drivers: net: cpsw: Add support for fixed-link
      PHY")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8cbcc466
    • Johan Hovold's avatar
      net: ethernet: ti: cpsw: fix deferred probe · a4e32b0d
      Johan Hovold authored
      Make sure to deregister all child devices also on probe errors to avoid
      leaks and to fix probe deferral:
      
      cpsw 4a100000.ethernet: omap_device: omap_device_enable() called from invalid state 1
      cpsw 4a100000.ethernet: use pm_runtime_put_sync_suspend() in driver?
      cpsw: probe of 4a100000.ethernet failed with error -22
      
      Add generic helper to undo the effects of cpsw_probe_dt(), which will
      also be used in a follow-on patch to fix further leaks that have been
      introduced more recently.
      
      Note that the platform device is now runtime-resumed before registering
      any child devices in order to make sure that it is synchronously
      suspended after having deregistered the children in the error path.
      
      Fixes: 1fb19aa7 ("net: cpsw: Add parent<->child relation support
      between cpsw and mdio")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a4e32b0d
    • Johan Hovold's avatar
      net: ethernet: ti: cpsw: fix mdio device reference leak · 86e1d5ad
      Johan Hovold authored
      Make sure to drop the reference taken by of_find_device_by_node() when
      looking up an mdio device from a phy_id property during probe.
      
      Fixes: 549985ee ("cpsw: simplify the setup of the register
      pointers")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      86e1d5ad
    • Johan Hovold's avatar
      net: ethernet: ti: cpsw: fix bad register access in probe error path · c46ab7e0
      Johan Hovold authored
      Make sure to keep the platform device runtime-resumed throughout probe
      to avoid accessing the CPSW registers in the error path (e.g. for
      deferred probe) with clocks disabled:
      
      Unhandled fault: external abort on non-linefetch (0x1008) at 0xd0872d08
      ...
      [<c04fabcc>] (cpsw_ale_control_set) from [<c04fb8b4>] (cpsw_ale_destroy+0x2c/0x44)
      [<c04fb8b4>] (cpsw_ale_destroy) from [<c04fea58>] (cpsw_probe+0xbd0/0x10c4)
      [<c04fea58>] (cpsw_probe) from [<c047b2a0>] (platform_drv_probe+0x5c/0xc0)
      
      Fixes: df828598 ("netdev: driver: ethernet: Add TI CPSW driver")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c46ab7e0
    • Jeremy Linton's avatar
      net: sky2: Fix shutdown crash · 06ba3b21
      Jeremy Linton authored
      The sky2 frequently crashes during machine shutdown with:
      
      sky2_get_stats+0x60/0x3d8 [sky2]
      dev_get_stats+0x68/0xd8
      rtnl_fill_stats+0x54/0x140
      rtnl_fill_ifinfo+0x46c/0xc68
      rtmsg_ifinfo_build_skb+0x7c/0xf0
      rtmsg_ifinfo.part.22+0x3c/0x70
      rtmsg_ifinfo+0x50/0x5c
      netdev_state_change+0x4c/0x58
      linkwatch_do_dev+0x50/0x88
      __linkwatch_run_queue+0x104/0x1a4
      linkwatch_event+0x30/0x3c
      process_one_work+0x140/0x3e0
      worker_thread+0x60/0x44c
      kthread+0xdc/0xf0
      ret_from_fork+0x10/0x50
      
      This is caused by the sky2 being called after it has been shutdown.
      A previous thread about this can be found here:
      
      https://lkml.org/lkml/2016/4/12/410
      
      An alternative fix is to assure that IFF_UP gets cleared by
      calling dev_close() during shutdown. This is similar to what the
      bnx2/tg3/xgene and maybe others are doing to assure that the driver
      isn't being called following _shutdown().
      Signed-off-by: default avatarJeremy Linton <jeremy.linton@arm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      06ba3b21
  2. 17 Nov, 2016 9 commits
  3. 16 Nov, 2016 21 commits