Skip to content
  1. Jun 11, 2017
  2. Jun 10, 2017
    • David S. Miller's avatar
      Merge tag 'linux-can-fixes-for-4.12-20170609' of... · f6d4c713
      David S. Miller authored
      
      Merge tag 'linux-can-fixes-for-4.12-20170609' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
      
      Marc Kleine-Budde says:
      
      ====================
      pull-request: can 2017-06-09
      
      this is a pull request of 6 patches for net/master.
      
      There's a patch by Stephane Grosjean that fixes an uninitialized symbol warning
      in the peak_canfd driver. A patch by Johan Hovold to fix the product-id
      endianness in an error message in the the peak_usb driver. A patch by Oliver
      Hartkopp to enable CAN FD for virtual CAN devices by default. Three patches by
      me, one makes the helper function can_change_state() robust to be called with
      cf == NULL. The next patch fixes a memory leak in the gs_usb driver. And the
      last one fixes a lockdep splat by properly initialize the per-net
      can_rcvlists_lock spin_lock.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f6d4c713
    • Johannes Berg's avatar
      mac80211: free netdev on dev_alloc_name() error · c7a61cba
      Johannes Berg authored
      The change to remove free_netdev() from ieee80211_if_free()
      erroneously didn't add the necessary free_netdev() for when
      ieee80211_if_free() is called directly in one place, rather
      than as the priv_destructor. Add the missing call.
      
      Fixes: cf124db5
      
       ("net: Fix inconsistent teardown and release of private netdev state.")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c7a61cba
    • ashwanth@codeaurora.org's avatar
      net: rps: send out pending IPI's on CPU hotplug · 773fc8f6
      ashwanth@codeaurora.org authored
      
      
      IPI's from the victim cpu are not handled in dev_cpu_callback.
      So these pending IPI's would be sent to the remote cpu only when
      NET_RX is scheduled on the victim cpu and since this trigger is
      unpredictable it would result in packet latencies on the remote cpu.
      
      This patch add support to send the pending ipi's of victim cpu.
      
      Signed-off-by: default avatarAshwanth Goli <ashwanth@codeaurora.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      773fc8f6
    • Mario Molitor's avatar
      stmmac: fix for hw timestamp of GMAC3 unit · 33d4c482
      Mario Molitor authored
      1.) Bugfix of function stmmac_get_tx_hwtstamp.
          Corrected the tx timestamp available check (same as 4.8 and older)
          Change printout from info syslevel to debug.
      
      2.) Bugfix of function stmmac_get_rx_hwtstamp.
          Corrected the rx timestamp available check (same as 4.8 and older)
          Change printout from info syslevel to debug.
      
      Fixes: ba1ffd74
      
       ("stmmac: fix PTP support for GMAC4")
      Signed-off-by: default avatarMario Molitor <mario_molitor@web.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      33d4c482
    • Mario Molitor's avatar
      stmmac: fix ptp header for GMAC3 hw timestamp · fd6720ae
      Mario Molitor authored
      According the CYCLON V documention only the bit 16 of snaptypesel should
      set.
      (more information see Table 17-20 (cv_5v4.pdf) :
       Timestamp Snapshot Dependency on Register Bits)
      
      Fixes: d2042052
      
       ("stmmac: update the PTP header file")
      Signed-off-by: default avatarMario Molitor <mario_molitor@web.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fd6720ae
    • Krister Johansen's avatar
      Fix an intermittent pr_emerg warning about lo becoming free. · f186ce61
      Krister Johansen authored
      
      
      It looks like this:
      
      Message from syslogd@flamingo at Apr 26 00:45:00 ...
       kernel:unregister_netdevice: waiting for lo to become free. Usage count = 4
      
      They seem to coincide with net namespace teardown.
      
      The message is emitted by netdev_wait_allrefs().
      
      Forced a kdump in netdev_run_todo, but found that the refcount on the lo
      device was already 0 at the time we got to the panic.
      
      Used bcc to check the blocking in netdev_run_todo.  The only places
      where we're off cpu there are in the rcu_barrier() and msleep() calls.
      That behavior is expected.  The msleep time coincides with the amount of
      time we spend waiting for the refcount to reach zero; the rcu_barrier()
      wait times are not excessive.
      
      After looking through the list of callbacks that the netdevice notifiers
      invoke in this path, it appears that the dst_dev_event is the most
      interesting.  The dst_ifdown path places a hold on the loopback_dev as
      part of releasing the dev associated with the original dst cache entry.
      Most of our notifier callbacks are straight-forward, but this one a)
      looks complex, and b) places a hold on the network interface in
      question.
      
      I constructed a new bcc script that watches various events in the
      liftime of a dst cache entry.  Note that dst_ifdown will take a hold on
      the loopback device until the invalidated dst entry gets freed.
      
      [      __dst_free] on DST: ffff883ccabb7900 IF tap1008300eth0 invoked at 1282115677036183
          __dst_free
          rcu_nocb_kthread
          kthread
          ret_from_fork
      Acked-by: default avatarEric Dumazet <edumazet@google.com>
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f186ce61
  3. Jun 09, 2017
  4. Jun 08, 2017
    • David S. Miller's avatar
      net: Fix build regression in rtl8723bs staging driver. · 0bed8650
      David S. Miller authored
      
      
      drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c: In function ‘rtw_cfg80211_add_monitor_if’:
      drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2670:10: error: ‘struct net_device’ has no member named ‘destructor’
        mon_ndev->destructor = rtw_ndev_destructor;
                ^
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0bed8650
    • David S. Miller's avatar
      Merge branch 'netvsc-bug-fixes' · bcdaa2b8
      David S. Miller authored
      
      
      Stephen Hemminger says:
      
      ====================
      netvsc: bug fixes
      
      These are bugfixes for netvsc driver in 4.12.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bcdaa2b8
    • stephen hemminger's avatar
      netvsc: move filter setting to rndis_device · 4f19c0d8
      stephen hemminger authored
      
      
      The work queue and handling of network filter parameters should
      be in rndis_device. This gets rid of warning from RCU checks,
      eliminates a race and cleans up code.
      
      Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4f19c0d8
    • stephen hemminger's avatar
      netvsc: fix net poll mode · a5ecd439
      stephen hemminger authored
      
      
      The ndo_poll_controller function needs to schedule NAPI to pick
      up arriving packets and send completions. Otherwise no data
      will ever be received. For simple case of netconsole, it also
      will allow send completions to happen.  Without this netpoll
      will eventually get stuck.
      
      Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a5ecd439
    • stephen hemminger's avatar
      netvsc: fix rcu dereference warning from ethtool · fbd4c7e7
      stephen hemminger authored
      
      
      The ethtool info command calls the netvsc get_sset_count with RTNL
      but not with RCU. Which causes warning:
      
      drivers/net/hyperv/netvsc_drv.c:1010 suspicious rcu_dereference_check() usage!
      
      Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fbd4c7e7
    • David Ahern's avatar
      net: ipv6: Release route when device is unregistering · 8397ed36
      David Ahern authored
      Roopa reported attempts to delete a bond device that is referenced in a
      multipath route is hanging:
      
      $ ifdown bond2    # ifupdown2 command that deletes virtual devices
      unregister_netdevice: waiting for bond2 to become free. Usage count = 2
      
      Steps to reproduce:
          echo 1 > /proc/sys/net/ipv6/conf/all/ignore_routes_with_linkdown
          ip link add dev bond12 type bond
          ip link add dev bond13 type bond
          ip addr add 2001:db8:2::0/64 dev bond12
          ip addr add 2001:db8:3::0/64 dev bond13
          ip route add 2001:db8:33::0/64 nexthop via 2001:db8:2::2 nexthop via 2001:db8:3::2
          ip link del dev bond12
          ip link del dev bond13
      
      The root cause is the recent change to keep routes on a linkdown. Update
      the check to detect when the device is unregistering and release the
      route for that case.
      
      Fixes: a1a22c12
      
       ("net: ipv6: Keep nexthop of multipath route on admin down")
      Reported-by: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Acked-by: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8397ed36
    • Mintz, Yuval's avatar
      net: Zero ifla_vf_info in rtnl_fill_vfinfo() · 0eed9cf5
      Mintz, Yuval authored
      
      
      Some of the structure's fields are not initialized by the
      rtnetlink. If driver doesn't set those in ndo_get_vf_config(),
      they'd leak memory to user.
      
      Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@cavium.com>
      CC: Michal Schmidt <mschmidt@redhat.com>
      Reviewed-by: default avatarGreg Rose <gvrose8192@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0eed9cf5
    • Mateusz Jurczyk's avatar
      decnet: dn_rtmsg: Improve input length sanitization in dnrmg_receive_user_skb · dd0da17b
      Mateusz Jurczyk authored
      
      
      Verify that the length of the socket buffer is sufficient to cover the
      nlmsghdr structure before accessing the nlh->nlmsg_len field for further
      input sanitization. If the client only supplies 1-3 bytes of data in
      sk_buff, then nlh->nlmsg_len remains partially uninitialized and
      contains leftover memory from the corresponding kernel allocation.
      Operating on such data may result in indeterminate evaluation of the
      nlmsg_len < sizeof(*nlh) expression.
      
      The bug was discovered by a runtime instrumentation designed to detect
      use of uninitialized memory in the kernel. The patch prevents this and
      other similar tools (e.g. KMSAN) from flagging this behavior in the future.
      
      Signed-off-by: default avatarMateusz Jurczyk <mjurczyk@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dd0da17b
    • David S. Miller's avatar
      Revert "decnet: dn_rtmsg: Improve input length sanitization in dnrmg_receive_user_skb" · c164772d
      David S. Miller authored
      This reverts commit 85eac2ba
      
      .
      
      There is an updated version of this fix which we should
      use instead.
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c164772d
    • Christian Lamparter's avatar
      net: emac: fix and unify emac_mdio functions · 9065bc38
      Christian Lamparter authored
      
      
      emac_mdio_read_link() was not copying the requested phy settings
      back into the emac driver's own phy api. This has caused a link
      speed mismatch issue for the AR8035 as the emac driver kept
      trying to connect with 10/100MBps on a 1GBit/s link.
      
      This patch also unifies shared code between emac_setup_aneg()
      and emac_mdio_setup_forced(). And furthermore it removes
      a chunk of emac_mdio_init_phy(), that was copying the same
      data into itself.
      
      Signed-off-by: default avatarChristian Lamparter <chunkeey@googlemail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9065bc38
    • Christian Lamparter's avatar
      net: emac: fix reset timeout with AR8035 phy · 19d90ece
      Christian Lamparter authored
      This patch fixes a problem where the AR8035 PHY can't be
      detected on an Cisco Meraki MR24, if the ethernet cable is
      not connected on boot.
      
      Russell Senior provided steps to reproduce the issue:
      |Disconnect ethernet cable, apply power, wait until device has booted,
      |plug in ethernet, check for interfaces, no eth0 is listed.
      |
      |This appears to be a problem during probing of the AR8035 Phy chip.
      |When ethernet has no link, the phy detection fails, and eth0 is not
      |created. Plugging ethernet later has no effect, because there is no
      |interface as far as the kernel is concerned. The relevant part of
      |the boot log looks like this:
      |this is the failing case:
      |
      |[    0.876611] /plb/opb/emac-rgmii@ef601500: input 0 in RGMII mode
      |[    0.882532] /plb/opb/ethernet@ef600c00: reset timeout
      |[    0.888546] /plb/opb/ethernet@ef600c00: can't find PHY!
      |and the succeeding case:
      |
      |[    0.876672] /plb/opb/emac-rgmii@ef601500: input 0 in RGMII mode
      |[    0.883952] eth0: EMAC-0 /plb/opb/ethernet@ef600c00, MAC 00:01:..
      |[    0.890822] eth0: found Atheros 8035 Gigabit Ethernet PHY (0x01)
      
      Based on the comment and the commit message of
      commit 23fbb5a8
      
       ("emac: Fix EMAC soft reset on 460EX/GT").
      This is because the AR8035 PHY doesn't provide the TX Clock,
      if the ethernet cable is not attached. This causes the reset
      to timeout and the PHY detection code in emac_init_phy() is
      unable to detect the AR8035 PHY. As a result, the emac driver
      bails out early and the user left with no ethernet.
      
      In order to stay compatible with existing configurations, the driver
      tries the current reset approach at first. Only if the first attempt
      timed out, it does perform one more retry with the clock temporarily
      switched to the internal source for just the duration of the reset.
      
      LEDE-Bug: #687 <https://bugs.lede-project.org/index.php?do=details&task_id=687>
      
      Cc: Chris Blake <chrisrblake93@gmail.com>
      Reported-by: default avatarRussell Senior <russell@personaltelco.net>
      Fixes: 23fbb5a8
      
       ("emac: Fix EMAC soft reset on 460EX/GT")
      Signed-off-by: default avatarChristian Lamparter <chunkeey@googlemail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      19d90ece
    • Mateusz Jurczyk's avatar
      decnet: dn_rtmsg: Improve input length sanitization in dnrmg_receive_user_skb · 85eac2ba
      Mateusz Jurczyk authored
      
      
      Verify that the length of the socket buffer is sufficient to cover the
      entire nlh->nlmsg_len field before accessing that field for further
      input sanitization. If the client only supplies 1-3 bytes of data in
      sk_buff, then nlh->nlmsg_len remains partially uninitialized and
      contains leftover memory from the corresponding kernel allocation.
      Operating on such data may result in indeterminate evaluation of the
      nlmsg_len < sizeof(*nlh) expression.
      
      The bug was discovered by a runtime instrumentation designed to detect
      use of uninitialized memory in the kernel. The patch prevents this and
      other similar tools (e.g. KMSAN) from flagging this behavior in the future.
      
      Signed-off-by: default avatarMateusz Jurczyk <mjurczyk@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      85eac2ba
    • David S. Miller's avatar
      hsi: Fix build regression due to netdev destructor fix. · ed66e50d
      David S. Miller authored
      
      
      > ../drivers/hsi/clients/ssi_protocol.c:1069:5: error: 'struct net_device' has no member named 'destructor'
      
      Reported-by: default avatarMark Brown <broonie@kernel.org>
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ed66e50d
    • Stephen Rothwell's avatar
    • David S. Miller's avatar
      net: Fix inconsistent teardown and release of private netdev state. · cf124db5
      David S. Miller authored
      
      
      Network devices can allocate reasources and private memory using
      netdev_ops->ndo_init().  However, the release of these resources
      can occur in one of two different places.
      
      Either netdev_ops->ndo_uninit() or netdev->destructor().
      
      The decision of which operation frees the resources depends upon
      whether it is necessary for all netdev refs to be released before it
      is safe to perform the freeing.
      
      netdev_ops->ndo_uninit() presumably can occur right after the
      NETDEV_UNREGISTER notifier completes and the unicast and multicast
      address lists are flushed.
      
      netdev->destructor(), on the other hand, does not run until the
      netdev references all go away.
      
      Further complicating the situation is that netdev->destructor()
      almost universally does also a free_netdev().
      
      This creates a problem for the logic in register_netdevice().
      Because all callers of register_netdevice() manage the freeing
      of the netdev, and invoke free_netdev(dev) if register_netdevice()
      fails.
      
      If netdev_ops->ndo_init() succeeds, but something else fails inside
      of register_netdevice(), it does call ndo_ops->ndo_uninit().  But
      it is not able to invoke netdev->destructor().
      
      This is because netdev->destructor() will do a free_netdev() and
      then the caller of register_netdevice() will do the same.
      
      However, this means that the resources that would normally be released
      by netdev->destructor() will not be.
      
      Over the years drivers have added local hacks to deal with this, by
      invoking their destructor parts by hand when register_netdevice()
      fails.
      
      Many drivers do not try to deal with this, and instead we have leaks.
      
      Let's close this hole by formalizing the distinction between what
      private things need to be freed up by netdev->destructor() and whether
      the driver needs unregister_netdevice() to perform the free_netdev().
      
      netdev->priv_destructor() performs all actions to free up the private
      resources that used to be freed by netdev->destructor(), except for
      free_netdev().
      
      netdev->needs_free_netdev is a boolean that indicates whether
      free_netdev() should be done at the end of unregister_netdevice().
      
      Now, register_netdevice() can sanely release all resources after
      ndo_ops->ndo_init() succeeds, by invoking both ndo_ops->ndo_uninit()
      and netdev->priv_destructor().
      
      And at the end of unregister_netdevice(), we invoke
      netdev->priv_destructor() and optionally call free_netdev().
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cf124db5
    • Daniel Borkmann's avatar
      bpf, arm64: use separate register for state in stxr · 7005cade
      Daniel Borkmann authored
      Will reported that in BPF_XADD we must use a different register in stxr
      instruction for the status flag due to otherwise CONSTRAINED UNPREDICTABLE
      behavior per architecture. Reference manual says [1]:
      
        If s == t, then one of the following behaviors must occur:
      
         * The instruction is UNDEFINED.
         * The instruction executes as a NOP.
         * The instruction performs the store to the specified address, but
           the value stored is UNKNOWN.
      
      Thus, use a different temporary register for the status flag to fix it.
      
      Disassembly extract from test 226/STX_XADD_DW from test_bpf.ko:
      
        [...]
        0000003c:  c85f7d4b  ldxr x11, [x10]
        00000040:  8b07016b  add x11, x11, x7
        00000044:  c80c7d4b  stxr w12, x11, [x10]
        00000048:  35ffffac  cbnz w12, 0x0000003c
        [...]
      
        [1] https://static.docs.arm.com/ddi0487/b/DDI0487B_a_armv8_arm.pdf, p.6132
      
      Fixes: 85f68fe8
      
       ("bpf, arm64: implement jiting of BPF_XADD")
      Reported-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7005cade
    • Antoine Ténart's avatar
      net: mvpp2: do not bypass the mvpp22_port_mii_set function · e173db36
      Antoine Ténart authored
      The mvpp22_port_mii_set() function was added by 26975821, but the
      function directly returns without doing anything. This return was used
      when debugging and wasn't removed before sending the patch. Fix this.
      
      Fixes: 26975821
      
       ("net: mvpp2: handle misc PPv2.1/PPv2.2 differences")
      Signed-off-by: default avatarAntoine Tenart <antoine.tenart@free-electrons.com>
      Acked-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e173db36