1. 08 3月, 2013 1 次提交
  2. 28 2月, 2013 1 次提交
    • S
      hlist: drop the node parameter from iterators · b67bfe0d
      Sasha Levin 提交于
      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;
          <+... when != b
      (
      hlist_for_each_entry(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_continue(a,
      - b,
      c) S
      |
      hlist_for_each_entry_from(a,
      - b,
      c) S
      |
      hlist_for_each_entry_rcu(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_rcu_bh(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_continue_rcu_bh(a,
      - b,
      c) S
      |
      for_each_busy_worker(a, c,
      - b,
      d) S
      |
      ax25_uid_for_each(a,
      - b,
      c) S
      |
      ax25_for_each(a,
      - b,
      c) S
      |
      inet_bind_bucket_for_each(a,
      - b,
      c) S
      |
      sctp_for_each_hentry(a,
      - b,
      c) S
      |
      sk_for_each(a,
      - b,
      c) S
      |
      sk_for_each_rcu(a,
      - b,
      c) S
      |
      sk_for_each_from
      -(a, b)
      +(a)
      S
      + sk_for_each_from(a) S
      |
      sk_for_each_safe(a,
      - b,
      c, d) S
      |
      sk_for_each_bound(a,
      - b,
      c) S
      |
      hlist_for_each_entry_safe(a,
      - b,
      c, d, e) S
      |
      hlist_for_each_entry_continue_rcu(a,
      - b,
      c) S
      |
      nr_neigh_for_each(a,
      - b,
      c) S
      |
      nr_neigh_for_each_safe(a,
      - b,
      c, d) S
      |
      nr_node_for_each(a,
      - b,
      c) S
      |
      nr_node_for_each_safe(a,
      - b,
      c, d) S
      |
      - for_each_gfn_sp(a, c, d, b) S
      + for_each_gfn_sp(a, c, d) S
      |
      - for_each_gfn_indirect_valid_sp(a, c, d, b) S
      + for_each_gfn_indirect_valid_sp(a, c, d) S
      |
      for_each_host(a,
      - b,
      c) S
      |
      for_each_host_safe(a,
      - b,
      c, d) S
      |
      for_each_mesh_entry(a,
      - b,
      c, d) S
      )
          ...+>
      
      [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: NPeter Senna Tschudin <peter.senna@gmail.com>
      Acked-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: NSasha Levin <sasha.levin@oracle.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Gleb Natapov <gleb@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b67bfe0d
  3. 02 2月, 2013 1 次提交
    • A
      Bluetooth: Reduce critical section in sco_conn_ready · 40528088
      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: [<ffffffffa0033ba6>] sco_chan_del+0x66/0x190 [bluetooth]
      
      but task is already holding lock:
       (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}, at: [<ffffffffa0033d5a>] 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){+.+...}:
             [<ffffffff81083011>] lock_acquire+0xb1/0xe0
             [<ffffffff813efd01>] _raw_spin_lock+0x41/0x80
             [<ffffffffa003436e>] sco_connect_cfm+0xbe/0x350 [bluetooth]
             [<ffffffffa0015d6c>] hci_event_packet+0xd3c/0x29b0 [bluetooth]
             [<ffffffffa0004583>] hci_rx_work+0x133/0x870 [bluetooth]
             [<ffffffff8104d65f>] process_one_work+0x2bf/0x4f0
             [<ffffffff81050022>] worker_thread+0x2b2/0x3e0
             [<ffffffff81056021>] kthread+0xd1/0xe0
             [<ffffffff813f14bc>] ret_from_fork+0x7c/0xb0
      
      -> #0 (&(&conn->lock)->rlock){+.+...}:
             [<ffffffff81082215>] __lock_acquire+0x1465/0x1c70
             [<ffffffff81083011>] lock_acquire+0xb1/0xe0
             [<ffffffff813efd01>] _raw_spin_lock+0x41/0x80
             [<ffffffffa0033ba6>] sco_chan_del+0x66/0x190 [bluetooth]
             [<ffffffffa0033d6d>] sco_conn_del+0x9d/0xe0 [bluetooth]
             [<ffffffffa0034653>] sco_disconn_cfm+0x53/0x60 [bluetooth]
             [<ffffffffa000fef3>] hci_disconn_complete_evt.isra.54+0x363/0x3c0 [bluetooth]
             [<ffffffffa00150f7>] hci_event_packet+0xc7/0x29b0 [bluetooth]
             [<ffffffffa0004583>] hci_rx_work+0x133/0x870 [bluetooth]
             [<ffffffff8104d65f>] process_one_work+0x2bf/0x4f0
             [<ffffffff81050022>] worker_thread+0x2b2/0x3e0
             [<ffffffff81056021>] kthread+0xd1/0xe0
             [<ffffffff813f14bc>] 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: [<ffffffff8104d5f8>] process_one_work+0x258/0x4f0
       #1:  ((&hdev->rx_work)){+.+.+.}, at: [<ffffffff8104d5f8>] process_one_work+0x258/0x4f0
       #2:  (&hdev->lock){+.+.+.}, at: [<ffffffffa000fbe9>] hci_disconn_complete_evt.isra.54+0x59/0x3c0 [bluetooth]
       #3:  (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}, at: [<ffffffffa0033d5a>] sco_conn_del+0x8a/0xe0 [bluetooth]
      
      stack backtrace:
      Pid: 1018, comm: kworker/u:1H Not tainted 3.8.0-rc1+ #7
      Call Trace:
       [<ffffffff813e92f9>] print_circular_bug+0x1fb/0x20c
       [<ffffffff81082215>] __lock_acquire+0x1465/0x1c70
       [<ffffffff81083011>] lock_acquire+0xb1/0xe0
       [<ffffffffa0033ba6>] ? sco_chan_del+0x66/0x190 [bluetooth]
       [<ffffffff813efd01>] _raw_spin_lock+0x41/0x80
       [<ffffffffa0033ba6>] ? sco_chan_del+0x66/0x190 [bluetooth]
       [<ffffffffa0033ba6>] sco_chan_del+0x66/0x190 [bluetooth]
       [<ffffffffa0033d6d>] sco_conn_del+0x9d/0xe0 [bluetooth]
       [<ffffffffa0034653>] sco_disconn_cfm+0x53/0x60 [bluetooth]
       [<ffffffffa000fef3>] hci_disconn_complete_evt.isra.54+0x363/0x3c0 [bluetooth]
       [<ffffffffa000fbd0>] ? hci_disconn_complete_evt.isra.54+0x40/0x3c0 [bluetooth]
       [<ffffffffa00150f7>] hci_event_packet+0xc7/0x29b0 [bluetooth]
       [<ffffffff81202e90>] ? __dynamic_pr_debug+0x80/0x90
       [<ffffffff8133ff7d>] ? kfree_skb+0x2d/0x40
       [<ffffffffa0021644>] ? hci_send_to_monitor+0x1a4/0x1c0 [bluetooth]
       [<ffffffffa0004583>] hci_rx_work+0x133/0x870 [bluetooth]
       [<ffffffff8104d5f8>] ? process_one_work+0x258/0x4f0
       [<ffffffff8104d65f>] process_one_work+0x2bf/0x4f0
       [<ffffffff8104d5f8>] ? process_one_work+0x258/0x4f0
       [<ffffffff8104fdc1>] ? worker_thread+0x51/0x3e0
       [<ffffffffa0004450>] ? hci_tx_work+0x800/0x800 [bluetooth]
       [<ffffffff81050022>] worker_thread+0x2b2/0x3e0
       [<ffffffff8104fd70>] ? busy_worker_rebind_fn+0x100/0x100
       [<ffffffff81056021>] kthread+0xd1/0xe0
       [<ffffffff81055f50>] ? flush_kthread_worker+0xc0/0xc0
       [<ffffffff813f14bc>] ret_from_fork+0x7c/0xb0
       [<ffffffff81055f50>] ? flush_kthread_worker+0xc0/0xc0
      Signed-off-by: NAndre Guedes <andre.guedes@openbossa.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      40528088
  4. 10 1月, 2013 1 次提交
    • G
      Bluetooth: Check if the hci connection exists in SCO shutdown · b7e98b51
      Gustavo Padovan 提交于
      Checking only for sco_conn seems to not be enough and lead to NULL
      dereferences in the code, check for hcon instead.
      
      <1>[11340.226404] BUG: unable to handle kernel NULL pointer dereference at
      0000000
      8
      <4>[11340.226619] EIP is at __sco_sock_close+0xe8/0x1a0
      <4>[11340.226629] EAX: f063a740 EBX: 00000000 ECX: f58f4544 EDX: 00000000
      <4>[11340.226640] ESI: dec83e00 EDI: 5f9a081f EBP: e0fdff38 ESP: e0fdff1c
      <0>[11340.226674] Stack:
      <4>[11340.226682]  c184db87 c1251028 dec83e00 e0fdff38 c1754aef dec83e00
      00000000
      e0fdff5c
      <4>[11340.226718]  c184f587 e0fdff64 e0fdff68 5f9a081f e0fdff5c c1751852
      d7813800
      62262f10
      <4>[11340.226752]  e0fdff70 c1753c00 00000000 00000001 0000000d e0fdffac
      c175425c
      00000041
      <0>[11340.226793] Call Trace:
      <4>[11340.226813]  [<c184db87>] ? sco_sock_clear_timer+0x27/0x60
      <4>[11340.226831]  [<c1251028>] ? local_bh_enable+0x68/0xd0
      <4>[11340.226846]  [<c1754aef>] ? lock_sock_nested+0x4f/0x60
      <4>[11340.226862]  [<c184f587>] sco_sock_shutdown+0x67/0xb0
      <4>[11340.226879]  [<c1751852>] ? sockfd_lookup_light+0x22/0x80
      <4>[11340.226897]  [<c1753c00>] sys_shutdown+0x30/0x60
      <4>[11340.226912]  [<c175425c>] sys_socketcall+0x1dc/0x2a0
      <4>[11340.226929]  [<c149ba78>] ? trace_hardirqs_on_thunk+0xc/0x10
      <4>[11340.226944]  [<c18860f1>] syscall_call+0x7/0xb
      <4>[11340.226960]  [<c1880000>] ? restore_cur+0x5e/0xd7
      <0>[11340.226969] Code: <f0> ff 4b 08 0f 94 c0 84 c0 74 20 80 7b 19 01 74
      2f b8 0a 00 00
      Reported-by: NChuansheng Liu <chuansheng.liu@intel.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      b7e98b51
  5. 04 12月, 2012 3 次提交
  6. 28 9月, 2012 2 次提交
  7. 07 8月, 2012 3 次提交
    • G
      Bluetooth: Fix possible deadlock in SCO code · 269c4845
      Gustavo Padovan 提交于
      sco_chan_del() only has conn != NULL when called from sco_conn_del() so
      just move the code from it that deal with conn to sco_conn_del().
      
      [  120.765529]
      [  120.765529] ======================================================
      [  120.766529] [ INFO: possible circular locking dependency detected ]
      [  120.766529] 3.5.0-rc1-10292-g3701f944-dirty #70 Tainted: G        W
      [  120.766529] -------------------------------------------------------
      [  120.766529] kworker/u:3/1497 is trying to acquire lock:
      [  120.766529]  (&(&conn->lock)->rlock#2){+.+...}, at:
      [<ffffffffa00b7ecc>] sco_chan_del+0x4c/0x170 [bluetooth]
      [  120.766529]
      [  120.766529] but task is already holding lock:
      [  120.766529]  (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}, at:
      [<ffffffffa00b8401>] sco_conn_del+0x61/0xe0 [bluetooth]
      [  120.766529]
      [  120.766529] which lock already depends on the new lock.
      [  120.766529]
      [  120.766529]
      [  120.766529] the existing dependency chain (in reverse order) is:
      [  120.766529]
      [  120.766529] -> #1 (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}:
      [  120.766529]        [<ffffffff8107980e>] lock_acquire+0x8e/0xb0
      [  120.766529]        [<ffffffff813c19e0>] _raw_spin_lock+0x40/0x80
      [  120.766529]        [<ffffffffa00b85e9>] sco_connect_cfm+0x79/0x300
      [bluetooth]
      [  120.766529]        [<ffffffffa0094b13>]
      hci_sync_conn_complete_evt.isra.90+0x343/0x400 [bluetooth]
      [  120.766529]        [<ffffffffa009d447>] hci_event_packet+0x317/0xfb0
      [bluetooth]
      [  120.766529]        [<ffffffffa008aa68>] hci_rx_work+0x2c8/0x890
      [bluetooth]
      [  120.766529]        [<ffffffff81047db7>] process_one_work+0x197/0x460
      [  120.766529]        [<ffffffff810489d6>] worker_thread+0x126/0x2d0
      [  120.766529]        [<ffffffff8104ee4d>] kthread+0x9d/0xb0
      [  120.766529]        [<ffffffff813c4294>] kernel_thread_helper+0x4/0x10
      [  120.766529]
      [  120.766529] -> #0 (&(&conn->lock)->rlock#2){+.+...}:
      [  120.766529]        [<ffffffff81078a8a>] __lock_acquire+0x154a/0x1d30
      [  120.766529]        [<ffffffff8107980e>] lock_acquire+0x8e/0xb0
      [  120.766529]        [<ffffffff813c19e0>] _raw_spin_lock+0x40/0x80
      [  120.766529]        [<ffffffffa00b7ecc>] sco_chan_del+0x4c/0x170
      [bluetooth]
      [  120.766529]        [<ffffffffa00b8414>] sco_conn_del+0x74/0xe0
      [bluetooth]
      [  120.766529]        [<ffffffffa00b88a2>] sco_disconn_cfm+0x32/0x60
      [bluetooth]
      [  120.766529]        [<ffffffffa0093a82>]
      hci_disconn_complete_evt.isra.53+0x242/0x390 [bluetooth]
      [  120.766529]        [<ffffffffa009d747>] hci_event_packet+0x617/0xfb0
      [bluetooth]
      [  120.766529]        [<ffffffffa008aa68>] hci_rx_work+0x2c8/0x890
      [bluetooth]
      [  120.766529]        [<ffffffff81047db7>] process_one_work+0x197/0x460
      [  120.766529]        [<ffffffff810489d6>] worker_thread+0x126/0x2d0
      [  120.766529]        [<ffffffff8104ee4d>] kthread+0x9d/0xb0
      [  120.766529]        [<ffffffff813c4294>] kernel_thread_helper+0x4/0x10
      [  120.766529]
      [  120.766529] other info that might help us debug this:
      [  120.766529]
      [  120.766529]  Possible unsafe locking scenario:
      [  120.766529]
      [  120.766529]        CPU0                    CPU1
      [  120.766529]        ----                    ----
      [  120.766529]   lock(slock-AF_BLUETOOTH-BTPROTO_SCO);
      [  120.766529]
      lock(&(&conn->lock)->rlock#2);
      [  120.766529]
      lock(slock-AF_BLUETOOTH-BTPROTO_SCO);
      [  120.766529]   lock(&(&conn->lock)->rlock#2);
      [  120.766529]
      [  120.766529]  *** DEADLOCK ***
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      269c4845
    • M
      Bluetooth: Added /proc/net/sco via bt_procfs_init() · de9b9212
      Masatake YAMATO 提交于
      Added /proc/net/sco via bt_procfs_init().
      Signed-off-by: NMasatake YAMATO <yamato@redhat.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      de9b9212
    • A
      Bluetooth: Make connect / disconnect cfm functions return void · 9e664631
      Andrei Emeltchenko 提交于
      Return values are never used because callers hci_proto_connect_cfm
      and hci_proto_disconn_cfm return void.
      Signed-off-by: NAndrei Emeltchenko <andrei.emeltchenko@intel.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      9e664631
  8. 05 6月, 2012 4 次提交
  9. 09 5月, 2012 7 次提交
  10. 29 3月, 2012 1 次提交
  11. 03 1月, 2012 1 次提交
  12. 23 12月, 2011 1 次提交
  13. 20 12月, 2011 1 次提交
  14. 19 12月, 2011 1 次提交
  15. 19 10月, 2011 1 次提交
  16. 12 8月, 2011 1 次提交
  17. 01 7月, 2011 1 次提交
  18. 11 6月, 2011 1 次提交
  19. 10 6月, 2011 1 次提交
  20. 12 5月, 2011 1 次提交
  21. 19 4月, 2011 1 次提交
  22. 28 2月, 2011 1 次提交
  23. 15 2月, 2011 1 次提交
    • G
      Bluetooth: Merge L2CAP and SCO modules into bluetooth.ko · 64274518
      Gustavo F. Padovan 提交于
      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: NGustavo F. Padovan <padovan@profusion.mobi>
      64274518
  24. 14 2月, 2011 1 次提交
  25. 02 12月, 2010 1 次提交
  26. 23 11月, 2010 1 次提交