22 Dec, 2011

1 commit


17 Jun, 2011

1 commit

  • Unnecessary casts of void * clutter the code.

    These are the remainder casts after several specific
    patches to remove netdev_priv and dev_priv.

    Done via coccinelle script:

    $ cat cast_void_pointer.cocci
    @@
    type T;
    T *pt;
    void *pv;
    @@

    - pt = (T *)pv;
    + pt = pv;

    Signed-off-by: Joe Perches
    Acked-by: Paul Moore
    Signed-off-by: David S. Miller

    Joe Perches
     

13 Apr, 2011

1 commit

  • 5b40964eadea40509d353318d2c82e8b7bf5e8a5 ("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:
    [] 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:
    [] ? irda_sendmsg+0x207/0x21d [irda]
    [] print_unlock_inbalance_bug+0xc7/0xd2
    [] ? irda_sendmsg+0x207/0x21d [irda]
    [] lock_release+0xcf/0x18e
    [] release_sock+0x2d/0x155
    [] irda_sendmsg+0x207/0x21d [irda]
    [] __sock_sendmsg+0x69/0x75
    [] sock_sendmsg+0xa1/0xb6
    [] ? might_fault+0x5c/0xac
    [] ? lock_release+0x181/0x18e
    [] ? might_fault+0xa5/0xac
    [] ? might_fault+0x5c/0xac
    [] ? fcheck_files+0xb9/0xf0
    [] ? copy_from_user+0x2f/0x31
    [] ? verify_iovec+0x52/0xa6
    [] sys_sendmsg+0x23a/0x2b8
    [] ? lock_release+0x181/0x18e
    [] ? up_read+0x28/0x2c
    [] ? do_page_fault+0x360/0x3b4
    [] ? trace_hardirqs_on_caller+0x10b/0x12f
    [] ? finish_task_switch+0xb2/0xe3
    [] ? finish_task_switch+0x46/0xe3
    [] ? trace_hardirqs_off_caller+0x33/0x90
    [] ? retint_swapgs+0x13/0x1b
    [] ? trace_hardirqs_on_caller+0x10b/0x12f
    [] ? audit_syscall_entry+0x11c/0x148
    [] ? trace_hardirqs_on_thunk+0x3a/0x3f
    [] system_call_fastpath+0x16/0x1b

    Signed-off-by: Dave Jones
    Signed-off-by: David S. Miller

    Dave Jones
     

27 Dec, 2010

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (42 commits)
    ipv4: dont create routes on down devices
    epic100: hamachi: yellowfin: Fix skb allocation size
    sundance: Fix oopses with corrupted skb_shared_info
    Revert "ipv4: Allow configuring subnets as local addresses"
    USB: mcs7830: return negative if auto negotiate fails
    irda: prevent integer underflow in IRLMP_ENUMDEVICES
    tcp: fix listening_get_next()
    atl1c: Do not use legacy PCI power management
    mac80211: fix mesh forwarding
    MAINTAINERS: email address change
    net: Fix range checks in tcf_valid_offset().
    net_sched: sch_sfq: fix allot handling
    hostap: remove netif_stop_queue from init
    mac80211/rt2x00: add ieee80211_tx_status_ni()
    typhoon: memory corruption in typhoon_get_drvinfo()
    net: Add USB PID for new MOSCHIP USB ethernet controller MCS7832 variant
    net_sched: always clone skbs
    ipv6: Fragment locally generated tunnel-mode IPSec6 packets as needed.
    netlink: fix gcc -Wconversion compilation warning
    asix: add USB ID for Logitec LAN-GTJ U2A
    ...

    Linus Torvalds
     

24 Dec, 2010

1 commit

  • If the user-provided len is less than the expected offset, the
    IRLMP_ENUMDEVICES getsockopt will do a copy_to_user() with a very large
    size value. While this isn't be a security issue on x86 because it will
    get caught by the access_ok() check, it may leak large amounts of kernel
    heap on other architectures. In any event, this patch fixes it.

    Signed-off-by: Dan Rosenberg
    Signed-off-by: David S. Miller

    Dan Rosenberg
     

18 Nov, 2010

1 commit


11 Oct, 2010

1 commit


24 Sep, 2010

1 commit


31 Aug, 2010

1 commit

  • If irda_open_tsap() fails, the irda_bind() code tries to destroy
    the ->ias_obj object by hand, but does so wrongly.

    In particular, it fails to a) release the hashbin attached to the
    object and b) reset the self->ias_obj pointer to NULL.

    Fix both problems by using irias_delete_object() and explicitly
    setting self->ias_obj to NULL, just as irda_release() does.

    Reported-by: Tavis Ormandy
    Signed-off-by: David S. Miller

    David S. Miller
     

21 Apr, 2010

1 commit

  • Define a new function to return the waitqueue of a "struct sock".

    static inline wait_queue_head_t *sk_sleep(struct sock *sk)
    {
    return sk->sk_sleep;
    }

    Change all read occurrences of sk_sleep by a call to this function.

    Needed for a future RCU conversion. sk_sleep wont be a field directly
    available.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

30 Mar, 2010

1 commit

  • …it 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: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

07 Nov, 2009

1 commit

  • 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: Arnd Bergmann
    Signed-off-by: David S. Miller

    Arnd Bergmann
     

06 Nov, 2009

1 commit

  • The generic __sock_create function has a kern argument which allows the
    security system to make decisions based on if a socket is being created by
    the kernel or by userspace. This patch passes that flag to the
    net_proto_family specific create function, so it can do the same thing.

    Signed-off-by: Eric Paris
    Acked-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Eric Paris
     

07 Oct, 2009

1 commit


01 Oct, 2009

1 commit

  • This provides safety against negative optlen at the type
    level instead of depending upon (sometimes non-trivial)
    checks against this sprinkled all over the the place, in
    each and every implementation.

    Based upon work done by Arjan van de Ven and feedback
    from Linus Torvalds.

    Signed-off-by: David S. Miller

    David S. Miller
     

10 Aug, 2009

1 commit


07 Aug, 2009

1 commit


13 Jul, 2009

1 commit

  • * Remove smp_lock.h from files which don't need it (including some headers!)
    * Add smp_lock.h to files which do need it
    * Make smp_lock.h include conditional in hardirq.h
    It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT

    This will make hardirq.h inclusion cheaper for every PREEMPT=n config
    (which includes allmodconfig/allyesconfig, BTW)

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

24 Jun, 2009

1 commit

  • 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: Herbert Xu
    Tested-by: Oliver Hartkopp
    Signed-off-by: David S. Miller

    Herbert Xu
     

18 Jun, 2009

1 commit

  • commit 2b85a34e911bf483c27cfdd124aeb1605145dc80
    (net: No more expensive sock_hold()/sock_put() on each tx)
    changed initial sk_wmem_alloc value.

    We need to take into account this offset when reporting
    sk_wmem_alloc to user, in PROC_FS files or various
    ioctls (SIOCOUTQ/TIOCOUTQ)

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

04 Jun, 2008

1 commit


26 Mar, 2008

1 commit


06 Mar, 2008

1 commit


29 Jan, 2008

1 commit

  • Many-many code in the kernel initialized the timer->function
    and timer->data together with calling init_timer(timer). There
    is already a helper for this. Use it for networking code.

    The patch is HUGE, but makes the code 130 lines shorter
    (98 insertions(+), 228 deletions(-)).

    Signed-off-by: Pavel Emelyanov
    Acked-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Pavel Emelyanov
     

21 Jan, 2008

1 commit

  • Here goes an IrDA patch against your latest net-2.6 tree.

    This patch fixes some af_irda memory leaks. It also checks for
    irias_new_obect() return value.

    Signed-off-by: Jesper Juhl
    Signed-off-by: Samuel Ortiz
    Signed-off-by: David S. Miller

    Jesper Juhl
     

09 Jan, 2008

1 commit


01 Nov, 2007

1 commit

  • Finally, the zero_it argument can be completely removed from
    the callers and from the function prototype.

    Besides, fix the checkpatch.pl warnings about using the
    assignments inside if-s.

    This patch is rather big, and it is a part of the previous one.
    I splitted it wishing to make the patches more readable. Hope
    this particular split helped.

    Signed-off-by: Pavel Emelyanov
    Signed-off-by: David S. Miller

    Pavel Emelyanov
     

11 Oct, 2007

2 commits

  • 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: Eric W. Biederman
    Signed-off-by: David S. Miller

    Eric W. Biederman
     
  • Signed-off-by: Samuel Ortiz
    Signed-off-by: David S. Miller

    Samuel Ortiz
     

18 Jul, 2007

1 commit

  • When having built-in IrDA, we hit the following error:

    `irda_sysctl_unregister' referenced in section `.init.text' of
    net/built-in.o: defined in discarded section `.exit.text' of
    net/built-in.o
    `irda_proc_unregister' referenced in section `.init.text' of
    net/built-in.o: defined in discarded section `.exit.text' of
    net/built-in.o
    `irsock_cleanup' referenced in section `.init.text' of net/built-in.o:
    defined in discarded section `.exit.text' of net/built-in.o
    `irttp_cleanup' referenced in section `.init.text' of net/built-in.o:
    defined in discarded section `.exit.text' of net/built-in.o
    `iriap_cleanup' referenced in section `.init.text' of net/built-in.o:
    defined in discarded section `.exit.text' of net/built-in.o
    `irda_device_cleanup' referenced in section `.init.text' of
    net/built-in.o: defined in discarded section `.exit.text' of
    net/built-in.o
    `irlap_cleanup' referenced in section `.init.text' of net/built-in.o:
    defined in discarded section `.exit.text' of net/built-in.o
    `irlmp_cleanup' referenced in section `.init.text' of net/built-in.o:
    defined in discarded section `.exit.text' of net/built-in.o
    make[1]: *** [.tmp_vmlinux1] Error 1
    make: *** [_all] Error 2

    This is due to the irda_init fix recently added, where we call __exit
    routines from an __init one. It is a build failure that I didn't catch
    because it doesn't show up when building IrDA as a module. My apologies
    for that.
    The following patch fixes that failure and is against your net-2.6
    tree. I hope it can make it to the merge window, and stable@kernel.org
    is CCed on this mail.

    Signed-off-by: Samuel Ortiz
    Signed-off-by: David S. Miller

    Samuel Ortiz
     

09 May, 2007

1 commit


26 Apr, 2007

7 commits


19 Apr, 2007

1 commit

  • This patch fixes an oops first reported in mid 2006 - see
    http://lkml.org/lkml/2006/8/29/358 The cause of this bug report is that
    when an error is signalled on the socket, irda_recvmsg_stream returns
    without removing a local wait_queue variable from the socket's sk_sleep
    queue. This causes havoc further down the road.

    In response to this problem, a patch was made that invoked sock_orphan on
    the socket when receiving a disconnect indication. This is not a good fix,
    as this sets sk_sleep to NULL, causing applications sleeping in recvmsg
    (and other places) to oops.

    This is against the latest net-2.6 and should be considered for -stable
    inclusion.

    Signed-off-by: Olaf Kirch
    Signed-off-by: Samuel Ortiz
    Signed-off-by: David S. Miller

    Olaf Kirch
     

11 Feb, 2007

1 commit