28 Feb, 2013

1 commit

  • I'm not sure why, but the hlist for each entry iterators were conceived

    list_for_each_entry(pos, head, member)

    The hlist ones were greedy and wanted an extra parameter:

    hlist_for_each_entry(tpos, pos, head, member)

    Why did they need an extra pos parameter? I'm not quite sure. Not only
    they don't really need it, it also prevents the iterator from looking
    exactly like the list iterator, which is unfortunate.

    Besides the semantic patch, there was some manual work required:

    - Fix up the actual hlist iterators in linux/list.h
    - Fix up the declaration of other iterators based on the hlist ones.
    - A very small amount of places were using the 'node' parameter, this
    was modified to use 'obj->member' instead.
    - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
    properly, so those had to be fixed up manually.

    The semantic patch which is mostly the work of Peter Senna Tschudin is here:

    @@
    iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

    type T;
    expression a,c,d,e;
    identifier b;
    statement S;
    @@

    -T b;

    [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
    [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
    [akpm@linux-foundation.org: checkpatch fixes]
    [akpm@linux-foundation.org: fix warnings]
    [akpm@linux-foudnation.org: redo intrusive kvm changes]
    Tested-by: Peter Senna Tschudin
    Acked-by: Paul E. McKenney
    Signed-off-by: Sasha Levin
    Cc: Wu Fengguang
    Cc: Marcelo Tosatti
    Cc: Gleb Natapov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin
     

22 Feb, 2013

2 commits

  • Pull trivial tree from Jiri Kosina:
    "Assorted tiny fixes queued in trivial tree"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (22 commits)
    DocBook: update EXPORT_SYMBOL entry to point at export.h
    Documentation: update top level 00-INDEX file with new additions
    ARM: at91/ide: remove unsused at91-ide Kconfig entry
    percpu_counter.h: comment code for better readability
    x86, efi: fix comment typo in head_32.S
    IB: cxgb3: delay freeing mem untill entirely done with it
    net: mvneta: remove unneeded version.h include
    time: x86: report_lost_ticks doesn't exist any more
    pcmcia: avoid static analysis complaint about use-after-free
    fs/jfs: Fix typo in comment : 'how may' -> 'how many'
    of: add missing documentation for of_platform_populate()
    btrfs: remove unnecessary cur_trans set before goto loop in join_transaction
    sound: soc: Fix typo in sound/codecs
    treewide: Fix typo in various drivers
    btrfs: fix comment typos
    Update ibmvscsi module name in Kconfig.
    powerpc: fix typo (utilties -> utilities)
    of: fix spelling mistake in comment
    h8300: Fix home page URL in h8300/README
    xtensa: Fix home page URL in Kconfig
    ...

    Linus Torvalds
     
  • Pull tty/serial patches from Greg Kroah-Hartman:
    "Here's the big tty/serial driver patches for 3.9-rc1.

    More tty port rework and fixes from Jiri here, as well as lots of
    individual serial driver updates and fixes.

    All of these have been in the linux-next tree for a while."

    * tag 'tty-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (140 commits)
    tty: mxser: improve error handling in mxser_probe() and mxser_module_init()
    serial: imx: fix uninitialized variable warning
    serial: tegra: assume CONFIG_OF
    TTY: do not update atime/mtime on read/write
    lguest: select CONFIG_TTY to build properly.
    ARM defconfigs: add missing inclusions of linux/platform_device.h
    fb/exynos: include platform_device.h
    ARM: sa1100/assabet: include platform_device.h directly
    serial: imx: Fix recursive locking bug
    pps: Fix build breakage from decoupling pps from tty
    tty: Remove ancient hardpps()
    pps: Additional cleanups in uart_handle_dcd_change
    pps: Move timestamp read into PPS code proper
    pps: Don't crash the machine when exiting will do
    pps: Fix a use-after free bug when unregistering a source.
    pps: Use pps_lookup_dev to reduce ldisc coupling
    pps: Add pps_lookup_dev() function
    tty: serial: uartlite: Support uartlite on big and little endian systems
    tty: serial: uartlite: Fix sparse and checkpatch warnings
    serial/arc-uart: Miscll DT related updates (Grant's review comments)
    ...

    Fix up trivial conflicts, mostly just due to the TTY config option
    clashing with the EXPERIMENTAL removal.

    Linus Torvalds
     

19 Feb, 2013

2 commits

  • proc_net_remove is only used to remove proc entries
    that under /proc/net,it's not a general function for
    removing proc entries of netns. if we want to remove
    some proc entries which under /proc/net/stat/, we still
    need to call remove_proc_entry.

    this patch use remove_proc_entry to replace proc_net_remove.
    we can remove proc_net_remove after this patch.

    Signed-off-by: Gao feng
    Signed-off-by: David S. Miller

    Gao feng
     
  • Right now, some modules such as bonding use proc_create
    to create proc entries under /proc/net/, and other modules
    such as ipv4 use proc_net_fops_create.

    It looks a little chaos.this patch changes all of
    proc_net_fops_create to proc_create. we can remove
    proc_net_fops_create after this patch.

    Signed-off-by: Gao feng
    Signed-off-by: David S. Miller

    Gao feng
     

09 Feb, 2013

2 commits


05 Feb, 2013

1 commit


02 Feb, 2013

14 commits

  • This patch does a trivial refactor in mgmt_pending_foreach function.
    It replaces list_for_each_safe by list_for_each_entry_safe, simplifying
    the function.

    Signed-off-by: Andre Guedes
    Signed-off-by: Gustavo Padovan

    Andre Guedes
     
  • This patch removes unneeded locking in hci_le_adv_report_evt. There
    is no need to lock hdev before calling mgmt_device_found.

    Signed-off-by: Andre Guedes
    Signed-off-by: Gustavo Padovan

    Andre Guedes
     
  • This patch reduces the critical section protected by sco_conn_lock in
    sco_conn_ready function. The lock is acquired only when it is really
    needed.

    This patch fixes the following lockdep warning which is generated
    when the host terminates a SCO connection.

    Today, this warning is a false positive. There is no way those
    two threads reported by lockdep are running at the same time since
    hdev->workqueue (where rx_work is queued) is single-thread. However,
    if somehow this behavior is changed in future, we will have a
    potential deadlock.

    ======================================================
    [ INFO: possible circular locking dependency detected ]
    3.8.0-rc1+ #7 Not tainted
    -------------------------------------------------------
    kworker/u:1H/1018 is trying to acquire lock:
    (&(&conn->lock)->rlock){+.+...}, at: [] sco_chan_del+0x66/0x190 [bluetooth]

    but task is already holding lock:
    (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}, at: [] sco_conn_del+0x8a/0xe0 [bluetooth]

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}:
    [] lock_acquire+0xb1/0xe0
    [] _raw_spin_lock+0x41/0x80
    [] sco_connect_cfm+0xbe/0x350 [bluetooth]
    [] hci_event_packet+0xd3c/0x29b0 [bluetooth]
    [] hci_rx_work+0x133/0x870 [bluetooth]
    [] process_one_work+0x2bf/0x4f0
    [] worker_thread+0x2b2/0x3e0
    [] kthread+0xd1/0xe0
    [] ret_from_fork+0x7c/0xb0

    -> #0 (&(&conn->lock)->rlock){+.+...}:
    [] __lock_acquire+0x1465/0x1c70
    [] lock_acquire+0xb1/0xe0
    [] _raw_spin_lock+0x41/0x80
    [] sco_chan_del+0x66/0x190 [bluetooth]
    [] sco_conn_del+0x9d/0xe0 [bluetooth]
    [] sco_disconn_cfm+0x53/0x60 [bluetooth]
    [] hci_disconn_complete_evt.isra.54+0x363/0x3c0 [bluetooth]
    [] hci_event_packet+0xc7/0x29b0 [bluetooth]
    [] hci_rx_work+0x133/0x870 [bluetooth]
    [] process_one_work+0x2bf/0x4f0
    [] worker_thread+0x2b2/0x3e0
    [] kthread+0xd1/0xe0
    [] ret_from_fork+0x7c/0xb0

    other info that might help us debug this:

    Possible unsafe locking scenario:

    CPU0 CPU1
    ---- ----
    lock(slock-AF_BLUETOOTH-BTPROTO_SCO);
    lock(&(&conn->lock)->rlock);
    lock(slock-AF_BLUETOOTH-BTPROTO_SCO);
    lock(&(&conn->lock)->rlock);

    *** DEADLOCK ***

    4 locks held by kworker/u:1H/1018:
    #0: (hdev->name#2){.+.+.+}, at: [] process_one_work+0x258/0x4f0
    #1: ((&hdev->rx_work)){+.+.+.}, at: [] process_one_work+0x258/0x4f0
    #2: (&hdev->lock){+.+.+.}, at: [] hci_disconn_complete_evt.isra.54+0x59/0x3c0 [bluetooth]
    #3: (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}, at: [] sco_conn_del+0x8a/0xe0 [bluetooth]

    stack backtrace:
    Pid: 1018, comm: kworker/u:1H Not tainted 3.8.0-rc1+ #7
    Call Trace:
    [] print_circular_bug+0x1fb/0x20c
    [] __lock_acquire+0x1465/0x1c70
    [] lock_acquire+0xb1/0xe0
    [] ? sco_chan_del+0x66/0x190 [bluetooth]
    [] _raw_spin_lock+0x41/0x80
    [] ? sco_chan_del+0x66/0x190 [bluetooth]
    [] sco_chan_del+0x66/0x190 [bluetooth]
    [] sco_conn_del+0x9d/0xe0 [bluetooth]
    [] sco_disconn_cfm+0x53/0x60 [bluetooth]
    [] hci_disconn_complete_evt.isra.54+0x363/0x3c0 [bluetooth]
    [] ? hci_disconn_complete_evt.isra.54+0x40/0x3c0 [bluetooth]
    [] hci_event_packet+0xc7/0x29b0 [bluetooth]
    [] ? __dynamic_pr_debug+0x80/0x90
    [] ? kfree_skb+0x2d/0x40
    [] ? hci_send_to_monitor+0x1a4/0x1c0 [bluetooth]
    [] hci_rx_work+0x133/0x870 [bluetooth]
    [] ? process_one_work+0x258/0x4f0
    [] process_one_work+0x2bf/0x4f0
    [] ? process_one_work+0x258/0x4f0
    [] ? worker_thread+0x51/0x3e0
    [] ? hci_tx_work+0x800/0x800 [bluetooth]
    [] worker_thread+0x2b2/0x3e0
    [] ? busy_worker_rebind_fn+0x100/0x100
    [] kthread+0xd1/0xe0
    [] ? flush_kthread_worker+0xc0/0xc0
    [] ret_from_fork+0x7c/0xb0
    [] ? flush_kthread_worker+0xc0/0xc0

    Signed-off-by: Andre Guedes
    Signed-off-by: Gustavo Padovan

    Andre Guedes
     
  • This patch increments the management interface revision due to the
    various fixes, improvements and other changes that have gone in lately.

    Signed-off-by: Johan Hedberg
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan

    Johan Hedberg
     
  • If a controller is powered on while the HCI_AUTO_OFF flag is set the
    link security setting (HCI_LINK_SECURITY) might not be in sync with the
    actual state of the controller (HCI_AUTH). This patch fixes the issue by
    checking for inequality between the intended and actual settings and
    sends a HCI_Write_Auth_Enable command if necessary.

    Signed-off-by: Johan Hedberg
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan

    Johan Hedberg
     
  • This patch adds the necessary code for encoding a list of 128-bit UUIDs
    into the EIR data.

    Signed-off-by: Johan Hedberg
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan

    Johan Hedberg
     
  • This patch adds the necessary code for inserting a list of 32-bit UUIDs
    into the EIR data.

    Signed-off-by: Johan Hedberg
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan

    Johan Hedberg
     
  • We will need to create three separate UUID lists in the EIR data (for
    16, 32 and 128 bit UUIDs) so the code is easier to follow if each list
    is generated in their own function.

    Signed-off-by: Johan Hedberg
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan

    Johan Hedberg
     
  • The amount of data encoded so far in the create_eir() function can be
    calculated simply through the difference between the data and ptr
    pointer variables. The eir_len variable then becomes essentially
    useless.

    Signed-off-by: Johan Hedberg
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan

    Johan Hedberg
     
  • There's no need to use two separate loops to generate a UUID list for
    the EIR data. This patch merges the two loops previously used for the
    16-bit UUID list generation into a single loop, thus simplifying the
    code a great deal.

    Signed-off-by: Johan Hedberg
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan

    Johan Hedberg
     
  • The UUID removal code can be simplified by using
    list_for_each_entry_safe instead of list_for_each_safe.

    Signed-off-by: Johan Hedberg
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan

    Johan Hedberg
     
  • The primary purpose of the UUIDs is to enable generation of EIR and AD
    data. In these data formats the UUIDs are split into separate fields
    based on whether they're 16, 32 or 128 bit UUIDs. To make the generation
    of these data fields simpler this patch adds a type member to the
    bt_uuid struct and assigns a value to it as soon as the UUID is added to
    the kernel. This way the type doesn't need to be calculated each time
    the UUID list is later iterated.

    Signed-off-by: Johan Hedberg
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan

    Johan Hedberg
     
  • The code for clearing the UUIDs list can be simplified by using
    list_for_each_entry_safe instead of list_for_each_safe.

    Signed-off-by: Johan Hedberg
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan

    Johan Hedberg
     
  • We should be encoding UUIDs to the EIR data in the same order that they
    were added to the kernel, i.e. each UUID should be added to the end of
    the UUIDs list. This patch fixes the issue by using list_add_tail
    instead of list_add for storing the UUIDs.

    Signed-off-by: Johan Hedberg
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan

    Johan Hedberg
     

01 Feb, 2013

2 commits

  • If occurs a LE or SCO hci_conn timeout and the connection is already
    established (BT_CONNECTED state), the connection is not terminated as
    expected. This bug can be reproduced using l2test or scotest tool.
    Once the connection is established, kill l2test/scotest and the
    connection won't be terminated.

    This patch fixes hci_conn_disconnect helper so it is able to
    terminate LE and SCO connections, as well as ACL.

    Signed-off-by: Andre Guedes
    Signed-off-by: Gustavo Padovan

    Andre Guedes
     
  • The conn->smp_chan pointer can be NULL if SMP PDUs arrive at unexpected
    moments. To avoid NULL pointer dereferences the code should be checking
    for this and disconnect if an unexpected SMP PDU arrives. This patch
    fixes the issue by adding a check for conn->smp_chan for all other PDUs
    except pairing request and security request (which are are the first
    PDUs to come to initialize the SMP context).

    Signed-off-by: Johan Hedberg
    CC: stable@vger.kernel.org
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan

    Johan Hedberg
     

31 Jan, 2013

1 commit


29 Jan, 2013

1 commit


23 Jan, 2013

14 commits