1. 20 4月, 2018 1 次提交
  2. 09 1月, 2018 1 次提交
  3. 27 6月, 2017 2 次提交
  4. 08 6月, 2017 1 次提交
    • D
      net: Fix inconsistent teardown and release of private netdev state. · cf124db5
      David S. Miller 提交于
      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: NDavid S. Miller <davem@davemloft.net>
      cf124db5
  5. 20 1月, 2017 1 次提交
  6. 28 6月, 2016 1 次提交
  7. 30 1月, 2015 1 次提交
    • N
      caif: remove wrong dev_net_set() call · 8997c27e
      Nicolas Dichtel 提交于
      src_net points to the netns where the netlink message has been received. This
      netns may be different from the netns where the interface is created (because
      the user may add IFLA_NET_NS_[PID|FD]). In this case, src_net is the link netns.
      
      It seems wrong to override the netns in the newlink() handler because if it
      was not already src_net, it means that the user explicitly asks to create the
      netdevice in another netns.
      
      CC: Sjur Brændeland <sjur.brandeland@stericsson.com>
      CC: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
      Fixes: 8391c4aa ("caif: Bugfixes in CAIF netdevice for close and flow control")
      Fixes: c4125400 ("caif-hsi: Add rtnl support")
      Signed-off-by: NNicolas Dichtel <nicolas.dichtel@6wind.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8997c27e
  8. 15 1月, 2014 1 次提交
  9. 24 4月, 2013 2 次提交
  10. 08 3月, 2013 1 次提交
  11. 20 8月, 2012 1 次提交
  12. 13 4月, 2012 1 次提交
  13. 02 4月, 2012 1 次提交
  14. 12 3月, 2012 1 次提交
  15. 08 2月, 2012 1 次提交
  16. 05 2月, 2012 1 次提交
  17. 22 6月, 2011 1 次提交
    • J
      Remove redundant linux/version.h includes from net/ · dec17b74
      Jesper Juhl 提交于
      It was suggested by "make versioncheck" that the follwing includes of
      linux/version.h are redundant:
      
        /home/jj/src/linux-2.6/net/caif/caif_dev.c: 14 linux/version.h not needed.
        /home/jj/src/linux-2.6/net/caif/chnl_net.c: 10 linux/version.h not needed.
        /home/jj/src/linux-2.6/net/ipv4/gre.c: 19 linux/version.h not needed.
        /home/jj/src/linux-2.6/net/netfilter/ipset/ip_set_core.c: 20 linux/version.h not needed.
        /home/jj/src/linux-2.6/net/netfilter/xt_set.c: 16 linux/version.h not needed.
      
      and it seems that it is right.
      
      Beyond manually inspecting the source files I also did a few build
      tests with various configs to confirm that including the header in
      those files is indeed not needed.
      
      Here's a patch to remove the pointless includes.
      Signed-off-by: NJesper Juhl <jj@chaosbits.net>
      Acked-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dec17b74
  18. 07 6月, 2011 1 次提交
  19. 02 6月, 2011 1 次提交
  20. 16 5月, 2011 3 次提交
  21. 09 2月, 2011 1 次提交
    • D
      net/caif: Fix dangling list pointer in freed object on error. · b2df5a84
      David S. Miller 提交于
      rtnl_link_ops->setup(), and the "setup" callback passed to alloc_netdev*(),
      cannot make state changes which need to be undone on failure.  There is
      no cleanup mechanism available at this point.
      
      So we have to add the caif private instance to the global list once we
      are sure that register_netdev() has succedded in ->newlink().
      
      Otherwise, if register_netdev() fails, the caller will invoke free_netdev()
      and we will have a reference to freed up memory on the chnl_net_list.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b2df5a84
  22. 11 1月, 2011 1 次提交
  23. 22 9月, 2010 1 次提交
  24. 07 9月, 2010 1 次提交
    • J
      net/caif: Use pr_fmt · b31fa5ba
      Joe Perches 提交于
      This patch standardizes caif message logging prefixes.
      
      Add #define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
      Add missing "\n"s to some logging messages
      Convert pr_warning to pr_warn
      
      This changes the logging message prefix from CAIF: to caif:
      for all uses but caif_socket.c and chnl_net.c.  Those now use
      their filename without extension.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b31fa5ba
  25. 21 6月, 2010 1 次提交
  26. 29 4月, 2010 1 次提交
  27. 31 3月, 2010 1 次提交