03 Jan, 2012

1 commit


23 Dec, 2011

1 commit


28 Sep, 2011

1 commit

  • ERTM reassembly will be more efficient when skbs are linked together
    rather than copying every incoming data byte. The existing stream recv
    function assumes skbs are linear, so it needs to know how to handle
    fragments before reassembly is changed.

    bt_sock_recvmsg() already handles fragmented skbs.

    Signed-off-by: Mat Martineau
    Signed-off-by: Gustavo F. Padovan

    Mat Martineau
     

12 Aug, 2011

1 commit


26 Feb, 2011

1 commit


18 Feb, 2011

1 commit


15 Feb, 2011

1 commit

  • Actually doesn't make sense have these modules built separately.
    The L2CAP layer is needed by almost all Bluetooth protocols and profiles.
    There isn't any real use case without having L2CAP loaded.
    SCO is only essential for Audio transfers, but it is so small that we can
    have it loaded always in bluetooth.ko without problems.
    If you really doesn't want it you can disable SCO in the kernel config.

    Signed-off-by: Gustavo F. Padovan

    Gustavo F. Padovan
     

08 Feb, 2011

2 commits

  • Crash can happen when tasklet handling connect/disconnect requests
    preempts socket accept. Can be reproduced with "l2test -r" on one
    side and several "l2test -c -b 1000 -i hci0 -P 10 " on the
    other side.

    disable taskets in socket accept and change lock_sock and release_sock
    to bh_lock_sock and bh_unlock_sock since we have to use spinlocks and
    there is no need to mark sock as owned by user.

    ...
    [ 3555.897247] Unable to handle kernel NULL pointer dereference at virtual
    address 000000bc
    [ 3555.915039] pgd = cab9c000
    [ 3555.917785] [000000bc] *pgd=8bf3d031, *pte=00000000, *ppte=00000000
    [ 3555.928314] Internal error: Oops: 17 [#1] PREEMPT
    [ 3555.999786] CPU: 0 Not tainted (2.6.32.21-13874-g67918ef #65)
    ...
    [ 3556.005981] PC is at bt_accept_unlink+0x20/0x58 [bluetooth]
    [ 3556.011627] LR is at bt_accept_dequeue+0x3c/0xe8 [bluetooth]
    ...
    [ 3556.161285] [] (bt_accept_unlink+0x20/0x58 [bluetooth]) from
    [] (bt_accept_dequeue+0x3c/0xe8 [bluetooth])
    [ 3556.172729] [] (bt_accept_dequeue+0x3c/0xe8 [bluetooth]) from
    [] (l2cap_sock_accept+0x100/0x15c [l2cap])
    [ 3556.184082] [] (l2cap_sock_accept+0x100/0x15c [l2cap]) from
    [] (sys_accept4+0x120/0x1e0)
    [ 3556.193969] [] (sys_accept4+0x120/0x1e0) from []
    (ret_fast_syscall+0x0/0x2c)
    [ 3556.202819] Code: e5813000 e5901164 e580c160 e580c15c (e1d13bbc)
    ...

    Signed-off-by: Andrei Emeltchenko
    Signed-off-by: Gustavo F. Padovan

    Andrei Emeltchenko
     
  • Fix checkpatch warnings concerning assignments in if conditions.

    Signed-off-by: Andrei Emeltchenko
    Signed-off-by: Gustavo F. Padovan

    Andrei Emeltchenko
     

12 Oct, 2010

1 commit

  • This commit adds a bt_sock_stream_recvmsg() function for use by any
    Bluetooth code that uses SOCK_STREAM sockets. This code is copied
    from rfcomm_sock_recvmsg() with minimal modifications to remove
    RFCOMM-specific functionality and improve readability.

    L2CAP (with the SOCK_STREAM socket type) and RFCOMM have common needs
    when it comes to reading data. Proper stream read semantics require
    that applications can read from a stream one byte at a time and not
    lose any data. The RFCOMM code already operated on and pulled data
    from the underlying L2CAP socket, so very few changes were required to
    make the code more generic for use with non-RFCOMM data over L2CAP.

    Applications that need more awareness of L2CAP frame boundaries are
    still free to use SOCK_SEQPACKET sockets, and may verify that they
    connection did not fall back to basic mode by calling getsockopt().

    Signed-off-by: Mat Martineau
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo F. Padovan

    Mat Martineau
     

07 Sep, 2010

1 commit


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
     

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
     

13 Oct, 2009

1 commit

  • Create a new socket level option to report number of queue overflows

    Recently I augmented the AF_PACKET protocol to report the number of frames lost
    on the socket receive queue between any two enqueued frames. This value was
    exported via a SOL_PACKET level cmsg. AFter I completed that work it was
    requested that this feature be generalized so that any datagram oriented socket
    could make use of this option. As such I've created this patch, It creates a
    new SOL_SOCKET level option called SO_RXQ_OVFL, which when enabled exports a
    SOL_SOCKET level cmsg that reports the nubmer of times the sk_receive_queue
    overflowed between any two given frames. It also augments the AF_PACKET
    protocol to take advantage of this new feature (as it previously did not touch
    sk->sk_drops, which this patch uses to record the overflow count). Tested
    successfully by me.

    Notes:

    1) Unlike my previous patch, this patch simply records the sk_drops value, which
    is not a number of drops between packets, but rather a total number of drops.
    Deltas must be computed in user space.

    2) While this patch currently works with datagram oriented protocols, it will
    also be accepted by non-datagram oriented protocols. I'm not sure if thats
    agreeable to everyone, but my argument in favor of doing so is that, for those
    protocols which aren't applicable to this option, sk_drops will always be zero,
    and reporting no drops on a receive queue that isn't used for those
    non-participating protocols seems reasonable to me. This also saves us having
    to code in a per-protocol opt in mechanism.

    3) This applies cleanly to net-next assuming that commit
    977750076d98c7ff6cbda51858bb5a5894a9d9ab (my af packet cmsg patch) is reverted

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

    Neil Horman
     

07 Oct, 2009

1 commit


06 Aug, 2009

1 commit


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
     

27 Feb, 2009

4 commits

  • When BT_DEFER_SETUP has been enabled on a Bluetooth socket it keeps
    signaling POLLIN all the time. This is a wrong behavior. The POLLIN
    should only be signaled if the client socket is in BT_CONNECT2 state
    and the parent has been BT_DEFER_SETUP enabled.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • Due to lockdep changes, the CONFIG_DEBUG_LOCK_ALLOC ifdef is not needed
    now. So just remove it here.

    The following commit fixed the !lockdep build warnings:

    commit e8f6fbf62de37cbc2e179176ac7010d5f4396b67
    Author: Ingo Molnar
    Date: Wed Nov 12 01:38:36 2008 +0000

    lockdep: include/linux/lockdep.h - fix warning in net/bluetooth/af_bluetooth.c

    Signed-off-by: Dave Young
    Signed-off-by: Marcel Holtmann

    Dave Young
     
  • With the support for the enhanced security model and the support for
    deferring connection setup, it is a good idea to increase various
    version numbers.

    This is purely cosmetic and has no effect on the behavior, but can
    be really helpful when debugging problems in different kernel versions.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • The L2CAP and RFCOMM applications require support for authorization
    and the ability of rejecting incoming connection requests. The socket
    interface is not really able to support this.

    This patch does the ground work for a socket option to defer connection
    setup. Setting this option allows calling of accept() and then the
    first read() will trigger the final connection setup. Calling close()
    would reject the connection.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     

30 Nov, 2008

3 commits

  • With the introduction of CONFIG_DYNAMIC_PRINTK_DEBUG it is possible to
    allow debugging without having to recompile the kernel. This patch turns
    all BT_DBG() calls into pr_debug() to support dynamic debug messages.

    As a side effect all CONFIG_BT_*_DEBUG statements are now removed and
    some broken debug entries have been fixed.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • The Bluetooth subsystem was not using the HCI Reset command when doing
    device initialization. The Bluetooth 1.0b specification was ambiguous
    on how the device firmware was suppose to handle it. Almost every device
    was triggering a transport reset at the same time. In case of USB this
    ended up in disconnects from the bus.

    All modern Bluetooth dongles handle this perfectly fine and a lot of
    them actually require that HCI Reset is sent. If not then they are
    either stuck in their HID Proxy mode or their internal structures for
    inquiry and paging are not correctly setup.

    To handle old and new devices smoothly the Bluetooth subsystem contains
    a quirk to force the HCI Reset on initialization. However maintaining
    such a quirk becomes more and more complicated. This patch turns the
    logic around and lets the old devices disable the HCI Reset command.

    The only device where the HCI_QUIRK_NO_RESET is still needed are the
    original Digianswer devices and dongles with an early CSR firmware.

    CSR reported that they fixed this for version 12 firmware. The last
    official release of version 11 firmware is build ID 115. The first
    version 12 candidate was build ID 117.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • After adding proper lockdep annotations for Bluetooth protocols the case
    when lockdep is disabled produced two compiler warnings:

    net/bluetooth/af_bluetooth.c:60: warning: ‘bt_key_strings’ defined but not used
    net/bluetooth/af_bluetooth.c:71: warning: ‘bt_slock_key_strings’ defined but not used

    Fix both of them by adding a CONFIG_DEBUG_LOCK_ALLOC conditional around
    them and re-arranging the code a little bit.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     

17 Oct, 2008

1 commit


09 Sep, 2008

1 commit

  • The Security Mode 4 of the Bluetooth 2.1 specification has strict
    authentication and encryption requirements. It is the initiators job
    to create a secure ACL link. However in case of malicious devices, the
    acceptor has to make sure that the ACL is encrypted before allowing
    any kind of L2CAP connection. The only exception here is the PSM 1 for
    the service discovery protocol, because that is allowed to run on an
    insecure ACL link.

    Previously it was enough to reject a L2CAP connection during the
    connection setup phase, but with Bluetooth 2.1 it is forbidden to
    do any L2CAP protocol exchange on an insecure link (except SDP).

    The new hci_conn_check_link_mode() function can be used to check the
    integrity of an ACL link. This functions also takes care of the cases
    where Security Mode 4 is disabled or one of the devices is based on
    an older specification.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     

18 Aug, 2008

1 commit

  • The Bluetooth entries for the MAINTAINERS file are a little bit too
    much. Consolidate them into two entries. One for Bluetooth drivers and
    another one for the Bluetooth subsystem.

    Also the MODULE_AUTHOR should indicate the current maintainer of the
    module and actually not the original author. Fix all Bluetooth modules
    to provide current maintainer information.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     

15 Jul, 2008

3 commits


02 Apr, 2008

1 commit

  • 'rfcomm connect' will trigger lockdep warnings which is caused by
    locking diffrent kinds of bluetooth sockets at the same time.

    So using sub-classes per AF_BLUETOOTH sub-type for lockdep.

    Thanks for the hints from dave jones.

    ---
    > From: Dave Jones
    > Date: Thu, 27 Mar 2008 12:21:56 -0400
    >
    > > Mar 27 08:10:57 localhost kernel: Pid: 3611, comm: obex-data-serve Not tainted 2.6.25-0.121.rc5.git4.fc9 #1
    > > Mar 27 08:10:57 localhost kernel: [__lock_acquire+2287/3089] __lock_acquire+0x8ef/0xc11
    > > Mar 27 08:10:57 localhost kernel: [sched_clock+8/11] ? sched_clock+0x8/0xb
    > > Mar 27 08:10:57 localhost kernel: [lock_acquire+106/144] lock_acquire+0x6a/0x90
    > > Mar 27 08:10:57 localhost kernel: [] ? l2cap_sock_bind+0x29/0x108 [l2cap]
    > > Mar 27 08:10:57 localhost kernel: [lock_sock_nested+182/198] lock_sock_nested+0xb6/0xc6
    > > Mar 27 08:10:57 localhost kernel: [] ? l2cap_sock_bind+0x29/0x108 [l2cap]
    > > Mar 27 08:10:57 localhost kernel: [security_socket_post_create+22/27] ? security_socket_post_create+0x16/0x1b
    > > Mar 27 08:10:57 localhost kernel: [__sock_create+388/472] ? __sock_create+0x184/0x1d8
    > > Mar 27 08:10:57 localhost kernel: [] l2cap_sock_bind+0x29/0x108 [l2cap]
    > > Mar 27 08:10:57 localhost kernel: [kernel_bind+10/13] kernel_bind+0xa/0xd
    > > Mar 27 08:10:57 localhost kernel: [] rfcomm_dlc_open+0xc8/0x294 [rfcomm]
    > > Mar 27 08:10:57 localhost kernel: [lock_sock_nested+187/198] ? lock_sock_nested+0xbb/0xc6
    > > Mar 27 08:10:57 localhost kernel: [] rfcomm_sock_connect+0x8b/0xc2 [rfcomm]
    > > Mar 27 08:10:57 localhost kernel: [sys_connect+96/125] sys_connect+0x60/0x7d
    > > Mar 27 08:10:57 localhost kernel: [__lock_acquire+1370/3089] ? __lock_acquire+0x55a/0xc11
    > > Mar 27 08:10:57 localhost kernel: [sys_socketcall+140/392] sys_socketcall+0x8c/0x188
    > > Mar 27 08:10:57 localhost kernel: [syscall_call+7/11] syscall_call+0x7/0xb
    ---

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

    Dave Young
     

11 Oct, 2007

1 commit

  • 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
     

26 Apr, 2007

1 commit

  • For the common, open coded 'skb->h.raw = skb->data' operation, so that we can
    later turn skb->h.raw into a offset, reducing the size of struct sk_buff in
    64bit land while possibly keeping it as a pointer on 32bit.

    This one touches just the most simple cases:

    skb->h.raw = skb->data;
    skb->h.raw = {skb_push|[__]skb_pull}()

    The next ones will handle the slightly more "complex" cases.

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

    Arnaldo Carvalho de Melo
     

11 Feb, 2007

1 commit


16 Oct, 2006

2 commits

  • The bt_proto array needs to be protected by some kind of locking to
    prevent a race condition between bt_sock_create and bt_sock_register.

    And in addition all calls to sk_alloc need to be made GFP_ATOMIC now.

    Signed-off-by: Masatake YAMATO
    Signed-off-by: Frederik Deweerdt
    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • Most Bluetooth chips don't support concurrent connect requests, because
    this would involve a multiple baseband page with only one radio. In the
    case an upper layer like L2CAP requests a concurrent connect these chips
    return the error "Command Disallowed" for the second request. If this
    happens it the responsibility of the Bluetooth core to queue the request
    and try again after the previous connect attempt has been completed.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     

29 Sep, 2006

1 commit


04 Jul, 2006

2 commits