08 Jan, 2009

1 commit

  • Convert to net_device_ops and use internal net_device_stats in bnep
    device.

    Note: no need for bnep_net_ioctl since if ioctl is not set, then
    dev_ifsioc handles it by returning -EOPNOTSUPP

    Signed-off-by: Stephen Hemminger
    Acked-by: Marcel Holtmann
    Signed-off-by: David S. Miller

    Stephen Hemminger
     

24 Dec, 2008

1 commit


19 Dec, 2008

1 commit

  • The kernel_accept() does not hold the module refcount of newsock->ops->owner,
    so we need __module_get(newsock->ops->owner) code after call kernel_accept()
    by hand.
    In sunrpc, the module refcount is missing to hold. So this cause kernel panic.

    Used following script to reproduct:

    while [ 1 ];
    do
    mount -t nfs4 192.168.0.19:/ /mnt
    touch /mnt/file
    umount /mnt
    lsmod | grep ipv6
    done

    This patch fixed the problem by add __module_get(newsock->ops->owner) to
    kernel_accept(). So we do not need to used __module_get(newsock->ops->owner)
    in every place when used kernel_accept().

    Signed-off-by: Wei Yongjun
    Signed-off-by: David S. Miller

    Wei Yongjun
     

15 Dec, 2008

1 commit


09 Dec, 2008

2 commits


30 Nov, 2008

6 commits

  • It turns out that the following sequence of actions will reproduce the
    oops:

    1. Create a new RFCOMM device (using RFCOMMCREATEDEV ioctl)
    2. (Try to) open the device
    3. Release the RFCOMM device (using RFCOMMRELEASEDEV ioctl)

    At this point, the "/dev/rfcomm*" device is still in use, but it is gone
    from the internal list, so the device id can be reused.

    4. Create a new RFCOMM device with the same device id as before

    And now kobject will complain that the TTY already exists.

    (See http://lkml.org/lkml/2008/7/13/89 for a reproducible test-case.)

    This patch attempts to correct this by only removing the device from the
    internal list of devices at the final unregister stage, so that the id
    won't get reused until the device has been completely destructed.

    This should be safe as the RFCOMM_TTY_RELEASED bit will be set for the
    device and prevent the device from being reopened after it has been
    released.

    Based on a report from Vegard Nossum

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • Newer GCC versions are a little bit picky about how to deal with format
    arguments:

    net/bluetooth/hci_sysfs.c: In function ‘hci_register_sysfs’:
    net/bluetooth/hci_sysfs.c:418: warning: format not a string literal and no format arguments

    It is simple enough to fix and makes the compiler happy.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • 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
     
  • struct hci_dev_list_req {
    __u16 dev_num;
    struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
    };

    sizeof(struct hci_dev_list_req) == 4, so the two bytes immediately
    following "dev_num" will never be initialized. When this structure
    is copied to userspace, these uninitialized bytes are leaked.

    Fix by using kzalloc() instead of kmalloc(). Found using kmemcheck.

    Signed-off-by: Vegard Nossum
    Signed-off-by: Marcel Holtmann

    Vegard Nossum
     

26 Nov, 2008

1 commit

  • fix this warning:

    net/bluetooth/rfcomm/sock.c: In function ‘rfcomm_sock_ioctl’:
    net/bluetooth/rfcomm/sock.c:795: warning: unused variable ‘sk’

    perhaps BT_DEBUG() should be improved to do printf format checking
    instead of the #ifdef, but that looks quite intrusive: each bluetooth
    .c file undefines the macro.

    Signed-off-by: Ingo Molnar
    Signed-off-by: David S. Miller

    Ingo Molnar
     

13 Nov, 2008

1 commit

  • We have some reasons to kill netdev->priv:
    1. netdev->priv is equal to netdev_priv().
    2. netdev_priv() wraps the calculation of netdev->priv's offset, obviously
    netdev_priv() is more flexible than netdev->priv.
    But we cann't kill netdev->priv, because so many drivers reference to it
    directly.

    This patch is a safe convert for netdev->priv to netdev_priv(netdev).
    Since all of the netdev->priv is only for read.
    But it is too big to be sent in one mail.
    I split it to 4 parts and make every part smaller than 100,000 bytes,
    which is max size allowed by vger.

    Signed-off-by: Wang Chen
    Signed-off-by: David S. Miller

    Wang Chen
     

11 Nov, 2008

1 commit


04 Nov, 2008

1 commit


17 Oct, 2008

2 commits


15 Oct, 2008

5 commits

  • Move connecting from usbhid to the hid layer and fix also hidp in
    that manner.
    This removes all the ignore/force hidinput/hiddev connecting quirks.

    Signed-off-by: Jiri Slaby
    Signed-off-by: Jiri Kosina

    Jiri Slaby
     
  • Move them from the core code to a separate driver.

    Signed-off-by: Jiri Slaby
    Signed-off-by: Jiri Kosina

    Jiri Slaby
     
  • Move ignore quirks from usbhid-quirks into hid-core code. Also don't output
    warning when ENODEV is error code in usbhid and try ordinal input in hidp
    when that error is returned.

    Signed-off-by: Jiri Slaby
    Signed-off-by: Jiri Kosina

    Jiri Slaby
     
  • Next step for complete hid bus, this patch includes:
    - call parser either from probe or from hid-core if there is no probe.
    - add ll_driver structure and centralize some stuff there (open, close...)
    - split and merge usb_hid_configure and hid_probe into several functions
    to allow hooks/fixes between them

    Signed-off-by: Jiri Slaby
    Signed-off-by: Jiri Kosina

    Jiri Slaby
     
  • Make a bus from hid core. This is the first step for converting all the
    quirks and separate almost-drivers into real drivers attached to this bus.

    It's implemented to change behaviour in very tiny manner, so that no driver
    needs to be changed this time.

    Also add generic drivers for both usb and bt into usbhid or hidp
    respectively which will bind all non-blacklisted device. Those blacklisted
    will be either grabbed by special drivers or by nobody if they are broken at
    the very rude base.

    Signed-off-by: Jiri Slaby
    Signed-off-by: Jiri Kosina

    Jiri Slaby
     

12 Sep, 2008

1 commit

  • To speed up the Simple Pairing connection setup, the support for the
    default link policy has been enabled. This is in contrast to settings
    the link policy on every connection setup. Using the default link policy
    is the preferred way since there is no need to dynamically change it for
    every connection.

    For backward compatibility reason and to support old userspace the
    HCISETLINKPOL ioctl has been switched over to using hci_request() to
    issue the HCI command for setting the default link policy instead of
    just storing it in the HCI device structure.

    However the hci_request() can only be issued when the device is
    brought up. If used on a device that is registered, but still down
    it will timeout and fail. This is problematic since the command is
    put on the TX queue and the Bluetooth core tries to submit it to
    hardware that is not ready yet. The timeout for these requests is
    10 seconds and this causes a significant regression when setting up
    a new device.

    The userspace can perfectly handle a failure of the HCISETLINKPOL
    ioctl and will re-submit it later, but the 10 seconds delay causes
    a problem. So in case hci_request() is called on a device that is
    still down, just fail it with ENETDOWN to indicate what happens.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     

09 Sep, 2008

3 commits

  • 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
     
  • With the introduction of Security Mode 4 and Simple Pairing from the
    Bluetooth 2.1 specification it became mandatory that the initiator
    requires authentication and encryption before any L2CAP channel can
    be established. The only exception here is PSM 1 for the service
    discovery protocol (SDP). It is meant to be used without any encryption
    since it contains only public information. This is how Bluetooth 2.0
    and before handle connections on PSM 1.

    For Bluetooth 2.1 devices the pairing procedure differentiates between
    no bonding, general bonding and dedicated bonding. The L2CAP layer
    wrongly uses always general bonding when creating new connections, but it
    should not do this for SDP connections. In this case the authentication
    requirement should be no bonding and the just-works model should be used,
    but in case of non-SDP connection it is required to use general bonding.

    If the new connection requires man-in-the-middle (MITM) protection, it
    also first wrongly creates an unauthenticated link key and then later on
    requests an upgrade to an authenticated link key to provide full MITM
    protection. With Simple Pairing the link key generation is an expensive
    operation (compared to Bluetooth 2.0 and before) and doing this twice
    during a connection setup causes a noticeable delay when establishing
    a new connection. This should be avoided to not regress from the expected
    Bluetooth 2.0 connection times. The authentication requirements are known
    up-front and so enforce them.

    To fulfill these requirements the hci_connect() function has been extended
    with an authentication requirement parameter that will be stored inside
    the connection information and can be retrieved by userspace at any
    time. This allows the correct IO capabilities exchange and results in
    the expected behavior.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • The ACL config stage keeps holding a reference count on incoming
    connections when requesting the extended features. This results in
    keeping an ACL link up without any users. The problem here is that
    the Bluetooth specification doesn't define an ownership of the ACL
    link and thus it can happen that the implementation on the initiator
    side doesn't care about disconnecting unused links. In this case the
    acceptor needs to take care of this.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     

18 Aug, 2008

2 commits

  • 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
     
  • The Bluetooth adapters and connections are best presented via a class
    in sysfs. The removal of the links inside the Bluetooth class broke
    assumptions by userspace programs on how to find attached adapters.

    This patch creates adapters and connections as part of the Bluetooth
    class, but it uses different device types to distinguish them. The
    userspace programs can now easily navigate in the sysfs device tree.

    The unused platform device and bus have been removed to keep the
    code simple and clean.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     

08 Aug, 2008

1 commit

  • The Bluetooth qualification for PAN demands testing with BNEP header
    compression disabled. This is actually pretty stupid and the Linux
    implementation outsmarts the test system since it compresses whenever
    possible. So to pass qualification two need parameters have been added
    to control the compression of source and destination headers.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     

22 Jul, 2008

1 commit


21 Jul, 2008

2 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (1232 commits)
    iucv: Fix bad merging.
    net_sched: Add size table for qdiscs
    net_sched: Add accessor function for packet length for qdiscs
    net_sched: Add qdisc_enqueue wrapper
    highmem: Export totalhigh_pages.
    ipv6 mcast: Omit redundant address family checks in ip6_mc_source().
    net: Use standard structures for generic socket address structures.
    ipv6 netns: Make several "global" sysctl variables namespace aware.
    netns: Use net_eq() to compare net-namespaces for optimization.
    ipv6: remove unused macros from net/ipv6.h
    ipv6: remove unused parameter from ip6_ra_control
    tcp: fix kernel panic with listening_get_next
    tcp: Remove redundant checks when setting eff_sacks
    tcp: options clean up
    tcp: Fix MD5 signatures for non-linear skbs
    sctp: Update sctp global memory limit allocations.
    sctp: remove unnecessary byteshifting, calculate directly in big-endian
    sctp: Allow only 1 listening socket with SO_REUSEADDR
    sctp: Do not leak memory on multiple listen() calls
    sctp: Support ipv6only AF_INET6 sockets.
    ...

    Linus Torvalds
     
  • Move the line disciplines towards a conventional ->ops arrangement. For
    the moment the actual 'tty_ldisc' struct in the tty is kept as part of
    the tty struct but this can then be changed if it turns out that when it
    all settles down we want to refcount ldiscs separately to the tty.

    Pull the ldisc code out of /proc and put it with our ldisc code.

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     

19 Jul, 2008

1 commit


15 Jul, 2008

6 commits

  • When requested the L2CAP layer will now enforce authentication and
    encryption on outgoing connections. The usefulness of this feature
    is kinda limited since it will not allow proper connection ownership
    tracking until the authentication procedure has been finished. This
    is a limitation of Bluetooth 2.0 and before and can only be fixed by
    using Simple Pairing.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • It has been reported that some eSCO capable headsets are not able to
    connect properly. The real reason for this is unclear at the moment. So
    for easier testing add a module parameter to disable eSCO connection
    creation.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • When using the HIDP or BNEP kernel support, the user-space needs to
    know if the connection has been terminated for some reasons. Wake up
    the application if that happens. Otherwise kernel and user-space are
    no longer on the same page and weird behaviors can happen.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • When an incoming RFCOMM socket connection gets converted into a TTY,
    it can happen that packets are lost. This mainly happens with the
    Handsfree profile where the remote side starts sending data right
    away. The problem is that these packets are in the socket receive
    queue. So when creating the TTY make sure to copy all pending packets
    from the socket receive queue to a private queue inside the TTY.

    To make this actually work, the flow control on the newly created TTY
    will be disabled and only enabled again when the TTY is opened by an
    application. And right before that, the pending packets will be put
    into the TTY flip buffer.

    Signed-off-by: Denis Kenzior
    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • When switching a RFCOMM socket to a TTY, the remote modem status might
    be needed later. Currently it is lost since the original configuration
    is done via the socket interface. So store the modem status and reply
    it when the socket has been converted to a TTY.

    Signed-off-by: Denis Kenzior
    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • While the RFCOMM TTY emulation can act like a real serial port, in
    reality it is not used like this. So to not mess up stupid applications,
    use the non-canonical mode by default.

    Signed-off-by: Denis Kenzior
    Signed-off-by: Marcel Holtmann

    Marcel Holtmann