1. 20 4月, 2013 1 次提交
  2. 27 3月, 2013 1 次提交
  3. 13 10月, 2012 1 次提交
  4. 07 10月, 2012 1 次提交
    • G
      netlink: add reference of module in netlink_dump_start · 6dc878a8
      Gao feng 提交于
      I get a panic when I use ss -a and rmmod inet_diag at the
      same time.
      
      It's because netlink_dump uses inet_diag_dump which belongs to module
      inet_diag.
      
      I search the codes and find many modules have the same problem.  We
      need to add a reference to the module which the cb->dump belongs to.
      
      Thanks for all help from Stephen,Jan,Eric,Steffen and Pablo.
      
      Change From v3:
      change netlink_dump_start to inline,suggestion from Pablo and
      Eric.
      
      Change From v2:
      delete netlink_dump_done,and call module_put in netlink_dump
      and netlink_sock_destruct.
      Signed-off-by: NGao feng <gaofeng@cn.fujitsu.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6dc878a8
  5. 23 9月, 2012 1 次提交
  6. 22 9月, 2012 1 次提交
  7. 11 9月, 2012 1 次提交
  8. 09 9月, 2012 2 次提交
  9. 08 9月, 2012 1 次提交
    • E
      scm: Don't use struct ucred in NETLINK_CB and struct scm_cookie. · dbe9a417
      Eric W. Biederman 提交于
      Passing uids and gids on NETLINK_CB from a process in one user
      namespace to a process in another user namespace can result in the
      wrong uid or gid being presented to userspace.  Avoid that problem by
      passing kuids and kgids instead.
      
      - define struct scm_creds for use in scm_cookie and netlink_skb_parms
        that holds uid and gid information in kuid_t and kgid_t.
      
      - Modify scm_set_cred to fill out scm_creds by heand instead of using
        cred_to_ucred to fill out struct ucred.  This conversion ensures
        userspace does not get incorrect uid or gid values to look at.
      
      - Modify scm_recv to convert from struct scm_creds to struct ucred
        before copying credential values to userspace.
      
      - Modify __scm_send to populate struct scm_creds on in the scm_cookie,
        instead of just copying struct ucred from userspace.
      
      - Modify netlink_sendmsg to copy scm_creds instead of struct ucred
        into the NETLINK_CB.
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dbe9a417
  10. 15 8月, 2012 1 次提交
  11. 30 6月, 2012 2 次提交
  12. 27 6月, 2012 1 次提交
  13. 09 5月, 2012 1 次提交
    • P
      netfilter: remove ip_queue support · d16cf20e
      Pablo Neira Ayuso 提交于
      This patch removes ip_queue support which was marked as obsolete
      years ago. The nfnetlink_queue modules provides more advanced
      user-space packet queueing mechanism.
      
      This patch also removes capability code included in SELinux that
      refers to ip_queue. Otherwise, we break compilation.
      
      Several warning has been sent regarding this to the mailing list
      in the past month without anyone rising the hand to stop this
      with some strong argument.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      d16cf20e
  14. 27 2月, 2012 2 次提交
  15. 31 1月, 2012 1 次提交
  16. 07 12月, 2011 1 次提交
  17. 21 10月, 2011 1 次提交
  18. 27 8月, 2011 1 次提交
  19. 08 8月, 2011 1 次提交
  20. 23 6月, 2011 1 次提交
    • J
      netlink: advertise incomplete dumps · 670dc283
      Johannes Berg 提交于
      Consider the following situation:
       * a dump that would show 8 entries, four in the first
         round, and four in the second
       * between the first and second rounds, 6 entries are
         removed
       * now the second round will not show any entry, and
         even if there is a sequence/generation counter the
         application will not know
      
      To solve this problem, add a new flag NLM_F_DUMP_INTR
      to the netlink header that indicates the dump wasn't
      consistent, this flag can also be set on the MSG_DONE
      message that terminates the dump, and as such above
      situation can be detected.
      
      To achieve this, add a sequence counter to the netlink
      callback struct. Of course, netlink code still needs
      to use this new functionality. The correct way to do
      that is to always set cb->seq when a dumpit callback
      is invoked and call nl_dump_check_consistent() for
      each new message. The core code will also call this
      function for the final MSG_DONE message.
      
      To make it usable with generic netlink, a new function
      genlmsg_nlhdr() is needed to obtain the netlink header
      from the genetlink user header.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      670dc283
  21. 10 6月, 2011 1 次提交
    • G
      rtnetlink: Compute and store minimum ifinfo dump size · c7ac8679
      Greg Rose 提交于
      The message size allocated for rtnl ifinfo dumps was limited to
      a single page.  This is not enough for additional interface info
      available with devices that support SR-IOV and caused a bug in
      which VF info would not be displayed if more than approximately
      40 VFs were created per interface.
      
      Implement a new function pointer for the rtnl_register service that will
      calculate the amount of data required for the ifinfo dump and allocate
      enough data to satisfy the request.
      Signed-off-by: NGreg Rose <gregory.v.rose@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      c7ac8679
  22. 21 5月, 2011 1 次提交
  23. 04 3月, 2011 2 次提交
  24. 18 12月, 2010 1 次提交
  25. 23 9月, 2010 1 次提交
  26. 22 5月, 2010 1 次提交
  27. 21 3月, 2010 1 次提交
  28. 05 11月, 2009 1 次提交
  29. 25 9月, 2009 1 次提交
    • J
      genetlink: fix netns vs. netlink table locking (2) · b8273570
      Johannes Berg 提交于
      Similar to commit d136f1bd,
      there's a bug when unregistering a generic netlink family,
      which is caught by the might_sleep() added in that commit:
      
          BUG: sleeping function called from invalid context at net/netlink/af_netlink.c:183
          in_atomic(): 1, irqs_disabled(): 0, pid: 1510, name: rmmod
          2 locks held by rmmod/1510:
           #0:  (genl_mutex){+.+.+.}, at: [<ffffffff8138283b>] genl_unregister_family+0x2b/0x130
           #1:  (rcu_read_lock){.+.+..}, at: [<ffffffff8138270c>] __genl_unregister_mc_group+0x1c/0x120
          Pid: 1510, comm: rmmod Not tainted 2.6.31-wl #444
          Call Trace:
           [<ffffffff81044ff9>] __might_sleep+0x119/0x150
           [<ffffffff81380501>] netlink_table_grab+0x21/0x100
           [<ffffffff813813a3>] netlink_clear_multicast_users+0x23/0x60
           [<ffffffff81382761>] __genl_unregister_mc_group+0x71/0x120
           [<ffffffff81382866>] genl_unregister_family+0x56/0x130
           [<ffffffffa0007d85>] nl80211_exit+0x15/0x20 [cfg80211]
           [<ffffffffa000005a>] cfg80211_exit+0x1a/0x40 [cfg80211]
      
      Fix in the same way by grabbing the netlink table lock
      before doing rcu_read_lock().
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b8273570
  30. 15 9月, 2009 1 次提交
    • J
      genetlink: fix netns vs. netlink table locking · d136f1bd
      Johannes Berg 提交于
      Since my commits introducing netns awareness into
      genetlink we can get this problem:
      
      BUG: scheduling while atomic: modprobe/1178/0x00000002
      2 locks held by modprobe/1178:
       #0:  (genl_mutex){+.+.+.}, at: [<ffffffff8135ee1a>] genl_register_mc_grou
       #1:  (rcu_read_lock){.+.+..}, at: [<ffffffff8135eeb5>] genl_register_mc_g
      Pid: 1178, comm: modprobe Not tainted 2.6.31-rc8-wl-34789-g95cb731-dirty #
      Call Trace:
       [<ffffffff8103e285>] __schedule_bug+0x85/0x90
       [<ffffffff81403138>] schedule+0x108/0x588
       [<ffffffff8135b131>] netlink_table_grab+0xa1/0xf0
       [<ffffffff8135c3a7>] netlink_change_ngroups+0x47/0x100
       [<ffffffff8135ef0f>] genl_register_mc_group+0x12f/0x290
      
      because I overlooked that netlink_table_grab() will
      schedule, thinking it was just the rwlock. However,
      in the contention case, that isn't actually true.
      
      Fix this by letting the code grab the netlink table
      lock first and then the RCU for netns protection.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d136f1bd
  31. 25 8月, 2009 1 次提交
  32. 25 3月, 2009 1 次提交
    • P
      netlink: add NETLINK_NO_ENOBUFS socket flag · 38938bfe
      Pablo Neira Ayuso 提交于
      This patch adds the NETLINK_NO_ENOBUFS socket flag. This flag can
      be used by unicast and broadcast listeners to avoid receiving
      ENOBUFS errors.
      
      Generally speaking, ENOBUFS errors are useful to notify two things
      to the listener:
      
      a) You may increase the receiver buffer size via setsockopt().
      b) You have lost messages, you may be out of sync.
      
      In some cases, ignoring ENOBUFS errors can be useful. For example:
      
      a) nfnetlink_queue: this subsystem does not have any sort of resync
      method and you can decide to ignore ENOBUFS once you have set a
      given buffer size.
      
      b) ctnetlink: you can use this together with the socket flag
      NETLINK_BROADCAST_SEND_ERROR to stop getting ENOBUFS errors as
      you do not need to resync (packets whose event are not delivered
      are drop to provide reliable logging and state-synchronization).
      
      Moreover, the use of NETLINK_NO_ENOBUFS also reduces a "go up, go down"
      effect in terms of performance which is due to the netlink congestion
      control when the listener cannot back off. The effect is the following:
      
      1) throughput rate goes up and netlink messages are inserted in the
      receiver buffer.
      2) Then, netlink buffer fills and overruns (set on nlk->state bit 0).
      3) While the listener empties the receiver buffer, netlink keeps
      dropping messages. Thus, throughput goes dramatically down.
      4) Then, once the listener has emptied the buffer (nlk->state
      bit 0 is set off), goto step 1.
      
      This effect is easy to trigger with netlink broadcast under heavy
      load, and it is more noticeable when using a big receiver buffer.
      You can find some results in [1] that show this problem.
      
      [1] http://1984.lsi.us.es/linux/netlink/
      
      This patch also includes the use of sk_drop to account the number of
      netlink messages drop due to overrun. This value is shown in
      /proc/net/netlink.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      38938bfe
  33. 20 2月, 2009 1 次提交
    • P
      netlink: add NETLINK_BROADCAST_ERROR socket option · be0c22a4
      Pablo Neira Ayuso 提交于
      This patch adds NETLINK_BROADCAST_ERROR which is a netlink
      socket option that the listener can set to make netlink_broadcast()
      return errors in the delivery to the caller. This option is useful
      if the caller of netlink_broadcast() do something with the result
      of the message delivery, like in ctnetlink where it drops a network
      packet if the event delivery failed, this is used to enable reliable
      logging and state-synchronization. If this socket option is not set,
      netlink_broadcast() only reports ESRCH errors and silently ignore
      ENOBUFS errors, which is what most netlink_broadcast() callers
      should do.
      
      This socket option is based on a suggestion from Patrick McHardy.
      Patrick McHardy can exchange this patch for a beer from me ;).
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Acked-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      be0c22a4
  34. 20 11月, 2008 1 次提交
  35. 01 10月, 2008 1 次提交
    • H
      ipsec: Put dumpers on the dump list · 12a169e7
      Herbert Xu 提交于
      Herbert Xu came up with the idea and the original patch to make
      xfrm_state dump list contain also dumpers:
      
      As it is we go to extraordinary lengths to ensure that states
      don't go away while dumpers go to sleep.  It's much easier if
      we just put the dumpers themselves on the list since they can't
      go away while they're going.
      
      I've also changed the order of addition on new states to prevent
      a never-ending dump.
      
      Timo Teräs improved the patch to apply cleanly to latest tree,
      modified iteration code to be more readable by using a common
      struct for entries in the list, implemented the same idea for
      xfrm_policy dumping and moved the af_key specific "last" entry
      caching to af_key.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NTimo Teras <timo.teras@iki.fi>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      12a169e7
  36. 23 9月, 2008 1 次提交
    • H
      ipsec: Fix xfrm_state_walk race · 5c182458
      Herbert Xu 提交于
      As discovered by Timo Teräs, the currently xfrm_state_walk scheme
      is racy because if a second dump finishes before the first, we
      may free xfrm states that the first dump would walk over later.
      
      This patch fixes this by storing the dumps in a list in order
      to calculate the correct completion counter which cures this
      problem.
      
      I've expanded netlink_cb in order to accomodate the extra state
      related to this.  It shouldn't be a big deal since netlink_cb
      is kmalloced for each dump and we're just increasing it by 4 or
      8 bytes.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5c182458