1. 03 11月, 2014 1 次提交
  2. 16 7月, 2014 1 次提交
  3. 19 1月, 2014 1 次提交
  4. 07 12月, 2013 1 次提交
  5. 21 11月, 2013 1 次提交
    • H
      net: rework recvmsg handler msg_name and msg_namelen logic · f3d33426
      Hannes Frederic Sowa 提交于
      This patch now always passes msg->msg_namelen as 0. recvmsg handlers must
      set msg_namelen to the proper size <= sizeof(struct sockaddr_storage)
      to return msg_name to the user.
      
      This prevents numerous uninitialized memory leaks we had in the
      recvmsg handlers and makes it harder for new code to accidentally leak
      uninitialized memory.
      
      Optimize for the case recvfrom is called with NULL as address. We don't
      need to copy the address at all, so set it to NULL before invoking the
      recvmsg handler. We can do so, because all the recvmsg handlers must
      cope with the case a plain read() is called on them. read() also sets
      msg_name to NULL.
      
      Also document these changes in include/linux/net.h as suggested by David
      Miller.
      
      Changes since RFC:
      
      Set msg->msg_name = NULL if user specified a NULL in msg_name but had a
      non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't
      affect sendto as it would bail out earlier while trying to copy-in the
      address. It also more naturally reflects the logic by the callers of
      verify_iovec.
      
      With this change in place I could remove "
      if (!uaddr || msg_sys->msg_namelen == 0)
      	msg->msg_name = NULL
      ".
      
      This change does not alter the user visible error logic as we ignore
      msg_namelen as long as msg_name is NULL.
      
      Also remove two unnecessary curly brackets in ___sys_recvmsg and change
      comments to netdev style.
      
      Cc: David Miller <davem@davemloft.net>
      Suggested-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f3d33426
  6. 04 10月, 2013 1 次提交
  7. 09 4月, 2013 2 次提交
  8. 08 4月, 2013 1 次提交
  9. 21 3月, 2013 1 次提交
  10. 05 2月, 2013 1 次提交
  11. 05 10月, 2012 1 次提交
  12. 17 7月, 2012 1 次提交
  13. 22 12月, 2011 1 次提交
  14. 17 6月, 2011 1 次提交
  15. 13 4月, 2011 1 次提交
    • D
      irda: fix locking unbalance in irda_sendmsg · 020318d0
      Dave Jones 提交于
      5b40964e ("irda: Remove BKL instances
      from af_irda.c") introduced a path where we have a locking unbalance.
      If we pass invalid flags, we unlock a socket we never locked,
      resulting in this...
      
      =====================================
      [ BUG: bad unlock balance detected! ]
      -------------------------------------
      trinity/20101 is trying to release lock (sk_lock-AF_IRDA) at:
      [<ffffffffa057f001>] irda_sendmsg+0x207/0x21d [irda]
      but there are no more locks to release!
      
      other info that might help us debug this:
      no locks held by trinity/20101.
      
      stack backtrace:
      Pid: 20101, comm: trinity Not tainted 2.6.39-rc3+ #3
      Call Trace:
       [<ffffffffa057f001>] ? irda_sendmsg+0x207/0x21d [irda]
       [<ffffffff81085041>] print_unlock_inbalance_bug+0xc7/0xd2
       [<ffffffffa057f001>] ? irda_sendmsg+0x207/0x21d [irda]
       [<ffffffff81086aca>] lock_release+0xcf/0x18e
       [<ffffffff813ed190>] release_sock+0x2d/0x155
       [<ffffffffa057f001>] irda_sendmsg+0x207/0x21d [irda]
       [<ffffffff813e9f8c>] __sock_sendmsg+0x69/0x75
       [<ffffffff813ea105>] sock_sendmsg+0xa1/0xb6
       [<ffffffff81100ca3>] ? might_fault+0x5c/0xac
       [<ffffffff81086b7c>] ? lock_release+0x181/0x18e
       [<ffffffff81100cec>] ? might_fault+0xa5/0xac
       [<ffffffff81100ca3>] ? might_fault+0x5c/0xac
       [<ffffffff81133b94>] ? fcheck_files+0xb9/0xf0
       [<ffffffff813f387a>] ? copy_from_user+0x2f/0x31
       [<ffffffff813f3b70>] ? verify_iovec+0x52/0xa6
       [<ffffffff813eb4e3>] sys_sendmsg+0x23a/0x2b8
       [<ffffffff81086b7c>] ? lock_release+0x181/0x18e
       [<ffffffff810773c6>] ? up_read+0x28/0x2c
       [<ffffffff814bec3d>] ? do_page_fault+0x360/0x3b4
       [<ffffffff81087043>] ? trace_hardirqs_on_caller+0x10b/0x12f
       [<ffffffff810458aa>] ? finish_task_switch+0xb2/0xe3
       [<ffffffff8104583e>] ? finish_task_switch+0x46/0xe3
       [<ffffffff8108364a>] ? trace_hardirqs_off_caller+0x33/0x90
       [<ffffffff814bbaf9>] ? retint_swapgs+0x13/0x1b
       [<ffffffff81087043>] ? trace_hardirqs_on_caller+0x10b/0x12f
       [<ffffffff810a9dd3>] ? audit_syscall_entry+0x11c/0x148
       [<ffffffff8125609e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
       [<ffffffff814c22c2>] system_call_fastpath+0x16/0x1b
      Signed-off-by: NDave Jones <davej@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      020318d0
  16. 24 12月, 2010 1 次提交
  17. 18 11月, 2010 1 次提交
  18. 11 10月, 2010 1 次提交
  19. 24 9月, 2010 1 次提交
  20. 31 8月, 2010 1 次提交
  21. 21 4月, 2010 1 次提交
  22. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  23. 07 11月, 2009 1 次提交
    • A
      net/irda: push BKL into proto_ops · 58a9d732
      Arnd Bergmann 提交于
      The irda driver uses the BKL implicitly in its protocol
      operations. Replace the wrapped proto_ops with explicit
      lock_kernel() calls makes the usage more obvious and
      shrinks the size of the object code.
      
      The calls t lock_kernel() should eventually all be replaced
      by other serialization methods, which requires finding out
      
      The calls t lock_kernel() should eventually all be replaced
      by other serialization methods, which requires finding out
      which data actually needs protection.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      58a9d732
  24. 06 11月, 2009 1 次提交
  25. 07 10月, 2009 1 次提交
  26. 01 10月, 2009 1 次提交
  27. 07 8月, 2009 1 次提交
  28. 13 7月, 2009 1 次提交
  29. 24 6月, 2009 1 次提交
    • H
      net: Move rx skb_orphan call to where needed · d55d87fd
      Herbert Xu 提交于
      In order to get the tun driver to account packets, we need to be
      able to receive packets with destructors set.  To be on the safe
      side, I added an skb_orphan call for all protocols by default since
      some of them (IP in particular) cannot handle receiving packets
      destructors properly.
      
      Now it seems that at least one protocol (CAN) expects to be able
      to pass skb->sk through the rx path without getting clobbered.
      
      So this patch attempts to fix this properly by moving the skb_orphan
      call to where it's actually needed.  In particular, I've added it
      to skb_set_owner_[rw] which is what most users of skb->destructor
      call.
      
      This is actually an improvement for tun too since it means that
      we only give back the amount charged to the socket when the skb
      is passed to another socket that will also be charged accordingly.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Tested-by: NOliver Hartkopp <olver@hartkopp.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d55d87fd
  30. 18 6月, 2009 1 次提交
  31. 04 6月, 2008 1 次提交
  32. 26 3月, 2008 1 次提交
  33. 06 3月, 2008 1 次提交
  34. 29 1月, 2008 1 次提交
  35. 21 1月, 2008 1 次提交
  36. 09 1月, 2008 1 次提交
  37. 01 11月, 2007 1 次提交
  38. 11 10月, 2007 2 次提交
    • E
      [NET]: Make socket creation namespace safe. · 1b8d7ae4
      Eric W. Biederman 提交于
      This patch passes in the namespace a new socket should be created in
      and has the socket code do the appropriate reference counting.  By
      virtue of this all socket create methods are touched.  In addition
      the socket create methods are modified so that they will fail if
      you attempt to create a socket in a non-default network namespace.
      
      Failing if we attempt to create a socket outside of the default
      network namespace ensures that as we incrementally make the network stack
      network namespace aware we will not export functionality that someone
      has not audited and made certain is network namespace safe.
      Allowing us to partially enable network namespaces before all of the
      exotic protocols are supported.
      
      Any protocol layers I have missed will fail to compile because I now
      pass an extra parameter into the socket creation code.
      
      [ Integrated AF_IUCV build fixes from Andrew Morton... -DaveM ]
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1b8d7ae4
    • S
      bcb5e0ee