Parent Directory
|
Revision Log
* Wed Mar 04 2009 Kyle McMartin <kyle@redhat.com> - Rebase git-bluetooth.patch from bluetooth-next-2.6 instead of bluetooth-testing, per Marcel's suggestions.
| 1 | commit b1fb06830dc870d862f7f80e276130c0ab84d59f |
| 2 | Author: Wei Yongjun <yjwei@cn.fujitsu.com> |
| 3 | Date: Wed Feb 25 18:09:33 2009 +0800 |
| 4 | |
| 5 | Bluetooth: Remove some pointless conditionals before kfree_skb() |
| 6 | |
| 7 | Remove some pointless conditionals before kfree_skb(). |
| 8 | |
| 9 | Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> |
| 10 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 11 | |
| 12 | commit 7585b97a48180f754ebdade1be94092e36bef365 |
| 13 | Author: Wei Yongjun <yjwei@cn.fujitsu.com> |
| 14 | Date: Wed Feb 25 18:29:52 2009 +0800 |
| 15 | |
| 16 | Bluetooth: Remove some pointless conditionals before kfree_skb() |
| 17 | |
| 18 | Remove some pointless conditionals before kfree_skb(). |
| 19 | |
| 20 | Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> |
| 21 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 22 | |
| 23 | commit 2ae9a6be5f476f3512839a4d11a8f432bfd2914c |
| 24 | Author: Dave Young <hidave.darkstar@gmail.com> |
| 25 | Date: Sat Feb 21 16:13:34 2009 +0800 |
| 26 | |
| 27 | Bluetooth: Move hci_conn_del_sysfs() back to avoid device destruct too early |
| 28 | |
| 29 | The following commit introduce a regression: |
| 30 | |
| 31 | commit 7d0db0a373195385a2e0b19d1f5e4b186fdcffac |
| 32 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 33 | Date: Mon Jul 14 20:13:51 2008 +0200 |
| 34 | |
| 35 | [Bluetooth] Use a more unique bus name for connections |
| 36 | |
| 37 | I get panic as following (by netconsole): |
| 38 | |
| 39 | [ 2709.344034] usb 5-1: new full speed USB device using uhci_hcd and address 4 |
| 40 | [ 2709.505776] usb 5-1: configuration #1 chosen from 1 choice |
| 41 | [ 2709.569207] Bluetooth: Generic Bluetooth USB driver ver 0.4 |
| 42 | [ 2709.570169] usbcore: registered new interface driver btusb |
| 43 | [ 2845.742781] BUG: unable to handle kernel paging request at 6b6b6c2f |
| 44 | [ 2845.742958] IP: [<c015515c>] __lock_acquire+0x6c/0xa80 |
| 45 | [ 2845.743087] *pde = 00000000 |
| 46 | [ 2845.743206] Oops: 0002 [#1] SMP |
| 47 | [ 2845.743377] last sysfs file: /sys/class/bluetooth/hci0/hci0:6/type |
| 48 | [ 2845.743742] Modules linked in: btusb netconsole snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss rfcomm l2cap bluetooth vfat fuse snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep snd_pcm pl2303 snd_timer psmouse usbserial snd 3c59x e100 serio_raw soundcore i2c_i801 intel_agp mii agpgart snd_page_alloc rtc_cmos rtc_core thermal processor rtc_lib button thermal_sys sg evdev |
| 49 | [ 2845.743742] |
| 50 | [ 2845.743742] Pid: 0, comm: swapper Not tainted (2.6.29-rc5-smp #54) Dell DM051 |
| 51 | [ 2845.743742] EIP: 0060:[<c015515c>] EFLAGS: 00010002 CPU: 0 |
| 52 | [ 2845.743742] EIP is at __lock_acquire+0x6c/0xa80 |
| 53 | [ 2845.743742] EAX: 00000046 EBX: 00000046 ECX: 6b6b6b6b EDX: 00000002 |
| 54 | [ 2845.743742] ESI: 6b6b6b6b EDI: 00000000 EBP: c064fd14 ESP: c064fcc8 |
| 55 | [ 2845.743742] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 |
| 56 | [ 2845.743742] Process swapper (pid: 0, ti=c064e000 task=c05d1400 task.ti=c064e000) |
| 57 | [ 2845.743742] Stack: |
| 58 | [ 2845.743742] c05d1400 00000002 c05d1400 00000001 00000002 00000000 f65388dc c05d1400 |
| 59 | [ 2845.743742] 6b6b6b6b 00000292 c064fd0c c0153732 00000000 00000000 00000001 f700fa50 |
| 60 | [ 2845.743742] 00000046 00000000 00000000 c064fd40 c0155be6 00000000 00000002 00000001 |
| 61 | [ 2845.743742] Call Trace: |
| 62 | [ 2845.743742] [<c0153732>] ? trace_hardirqs_on_caller+0x72/0x1c0 |
| 63 | [ 2845.743742] [<c0155be6>] ? lock_acquire+0x76/0xa0 |
| 64 | [ 2845.743742] [<c03e1aad>] ? skb_dequeue+0x1d/0x70 |
| 65 | [ 2845.743742] [<c046c885>] ? _spin_lock_irqsave+0x45/0x80 |
| 66 | [ 2845.743742] [<c03e1aad>] ? skb_dequeue+0x1d/0x70 |
| 67 | [ 2845.743742] [<c03e1aad>] ? skb_dequeue+0x1d/0x70 |
| 68 | [ 2845.743742] [<c03e1f94>] ? skb_queue_purge+0x14/0x20 |
| 69 | [ 2845.743742] [<f8171f5a>] ? hci_conn_del+0x10a/0x1c0 [bluetooth] |
| 70 | [ 2845.743742] [<f81399c9>] ? l2cap_disconn_ind+0x59/0xb0 [l2cap] |
| 71 | [ 2845.743742] [<f81795ce>] ? hci_conn_del_sysfs+0x8e/0xd0 [bluetooth] |
| 72 | [ 2845.743742] [<f8175758>] ? hci_event_packet+0x5f8/0x31c0 [bluetooth] |
| 73 | [ 2845.743742] [<c03dfe19>] ? sock_def_readable+0x59/0x80 |
| 74 | [ 2845.743742] [<c046c14d>] ? _read_unlock+0x1d/0x20 |
| 75 | [ 2845.743742] [<f8178aa9>] ? hci_send_to_sock+0xe9/0x1d0 [bluetooth] |
| 76 | [ 2845.743742] [<c015388b>] ? trace_hardirqs_on+0xb/0x10 |
| 77 | [ 2845.743742] [<f816fa6a>] ? hci_rx_task+0x2ba/0x490 [bluetooth] |
| 78 | [ 2845.743742] [<c0133661>] ? tasklet_action+0x31/0xc0 |
| 79 | [ 2845.743742] [<c013367c>] ? tasklet_action+0x4c/0xc0 |
| 80 | [ 2845.743742] [<c0132eb7>] ? __do_softirq+0xa7/0x170 |
| 81 | [ 2845.743742] [<c0116dec>] ? ack_apic_level+0x5c/0x1c0 |
| 82 | [ 2845.743742] [<c0132fd7>] ? do_softirq+0x57/0x60 |
| 83 | [ 2845.743742] [<c01333dc>] ? irq_exit+0x7c/0x90 |
| 84 | [ 2845.743742] [<c01055bb>] ? do_IRQ+0x4b/0x90 |
| 85 | [ 2845.743742] [<c01333d5>] ? irq_exit+0x75/0x90 |
| 86 | [ 2845.743742] [<c010392c>] ? common_interrupt+0x2c/0x34 |
| 87 | [ 2845.743742] [<c010a14f>] ? mwait_idle+0x4f/0x70 |
| 88 | [ 2845.743742] [<c0101c05>] ? cpu_idle+0x65/0xb0 |
| 89 | [ 2845.743742] [<c045731e>] ? rest_init+0x4e/0x60 |
| 90 | [ 2845.743742] Code: 0f 84 69 02 00 00 83 ff 07 0f 87 1e 06 00 00 85 ff 0f 85 08 05 00 00 8b 4d cc 8b 49 04 85 c9 89 4d d4 0f 84 f7 04 00 00 8b 75 d4 <f0> ff 86 c4 00 00 00 89 f0 e8 56 a9 ff ff 85 c0 0f 85 6e 03 00 |
| 91 | [ 2845.743742] EIP: [<c015515c>] __lock_acquire+0x6c/0xa80 SS:ESP 0068:c064fcc8 |
| 92 | [ 2845.743742] ---[ end trace 4c985b38f022279f ]--- |
| 93 | [ 2845.743742] Kernel panic - not syncing: Fatal exception in interrupt |
| 94 | [ 2845.743742] ------------[ cut here ]------------ |
| 95 | [ 2845.743742] WARNING: at kernel/smp.c:329 smp_call_function_many+0x151/0x200() |
| 96 | [ 2845.743742] Hardware name: Dell DM051 |
| 97 | [ 2845.743742] Modules linked in: btusb netconsole snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss rfcomm l2cap bluetooth vfat fuse snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep snd_pcm pl2303 snd_timer psmouse usbserial snd 3c59x e100 serio_raw soundcore i2c_i801 intel_agp mii agpgart snd_page_alloc rtc_cmos rtc_core thermal processor rtc_lib button thermal_sys sg evdev |
| 98 | [ 2845.743742] Pid: 0, comm: swapper Tainted: G D 2.6.29-rc5-smp #54 |
| 99 | [ 2845.743742] Call Trace: |
| 100 | [ 2845.743742] [<c012e076>] warn_slowpath+0x86/0xa0 |
| 101 | [ 2845.743742] [<c015041b>] ? trace_hardirqs_off+0xb/0x10 |
| 102 | [ 2845.743742] [<c0146384>] ? up+0x14/0x40 |
| 103 | [ 2845.743742] [<c012e661>] ? release_console_sem+0x31/0x1e0 |
| 104 | [ 2845.743742] [<c046c8ab>] ? _spin_lock_irqsave+0x6b/0x80 |
| 105 | [ 2845.743742] [<c015041b>] ? trace_hardirqs_off+0xb/0x10 |
| 106 | [ 2845.743742] [<c046c900>] ? _read_lock_irqsave+0x40/0x80 |
| 107 | [ 2845.743742] [<c012e7f2>] ? release_console_sem+0x1c2/0x1e0 |
| 108 | [ 2845.743742] [<c0146384>] ? up+0x14/0x40 |
| 109 | [ 2845.743742] [<c015041b>] ? trace_hardirqs_off+0xb/0x10 |
| 110 | [ 2845.743742] [<c046a3d7>] ? __mutex_unlock_slowpath+0x97/0x160 |
| 111 | [ 2845.743742] [<c046a563>] ? mutex_trylock+0xb3/0x180 |
| 112 | [ 2845.743742] [<c046a4a8>] ? mutex_unlock+0x8/0x10 |
| 113 | [ 2845.743742] [<c015b991>] smp_call_function_many+0x151/0x200 |
| 114 | [ 2845.743742] [<c010a1a0>] ? stop_this_cpu+0x0/0x40 |
| 115 | [ 2845.743742] [<c015ba61>] smp_call_function+0x21/0x30 |
| 116 | [ 2845.743742] [<c01137ae>] native_smp_send_stop+0x1e/0x50 |
| 117 | [ 2845.743742] [<c012e0f5>] panic+0x55/0x110 |
| 118 | [ 2845.743742] [<c01065a8>] oops_end+0xb8/0xc0 |
| 119 | [ 2845.743742] [<c010668f>] die+0x4f/0x70 |
| 120 | [ 2845.743742] [<c011a8c9>] do_page_fault+0x269/0x610 |
| 121 | [ 2845.743742] [<c011a660>] ? do_page_fault+0x0/0x610 |
| 122 | [ 2845.743742] [<c046cbaf>] error_code+0x77/0x7c |
| 123 | [ 2845.743742] [<c015515c>] ? __lock_acquire+0x6c/0xa80 |
| 124 | [ 2845.743742] [<c0153732>] ? trace_hardirqs_on_caller+0x72/0x1c0 |
| 125 | [ 2845.743742] [<c0155be6>] lock_acquire+0x76/0xa0 |
| 126 | [ 2845.743742] [<c03e1aad>] ? skb_dequeue+0x1d/0x70 |
| 127 | [ 2845.743742] [<c046c885>] _spin_lock_irqsave+0x45/0x80 |
| 128 | [ 2845.743742] [<c03e1aad>] ? skb_dequeue+0x1d/0x70 |
| 129 | [ 2845.743742] [<c03e1aad>] skb_dequeue+0x1d/0x70 |
| 130 | [ 2845.743742] [<c03e1f94>] skb_queue_purge+0x14/0x20 |
| 131 | [ 2845.743742] [<f8171f5a>] hci_conn_del+0x10a/0x1c0 [bluetooth] |
| 132 | [ 2845.743742] [<f81399c9>] ? l2cap_disconn_ind+0x59/0xb0 [l2cap] |
| 133 | [ 2845.743742] [<f81795ce>] ? hci_conn_del_sysfs+0x8e/0xd0 [bluetooth] |
| 134 | [ 2845.743742] [<f8175758>] hci_event_packet+0x5f8/0x31c0 [bluetooth] |
| 135 | [ 2845.743742] [<c03dfe19>] ? sock_def_readable+0x59/0x80 |
| 136 | [ 2845.743742] [<c046c14d>] ? _read_unlock+0x1d/0x20 |
| 137 | [ 2845.743742] [<f8178aa9>] ? hci_send_to_sock+0xe9/0x1d0 [bluetooth] |
| 138 | [ 2845.743742] [<c015388b>] ? trace_hardirqs_on+0xb/0x10 |
| 139 | [ 2845.743742] [<f816fa6a>] hci_rx_task+0x2ba/0x490 [bluetooth] |
| 140 | [ 2845.743742] [<c0133661>] ? tasklet_action+0x31/0xc0 |
| 141 | [ 2845.743742] [<c013367c>] tasklet_action+0x4c/0xc0 |
| 142 | [ 2845.743742] [<c0132eb7>] __do_softirq+0xa7/0x170 |
| 143 | [ 2845.743742] [<c0116dec>] ? ack_apic_level+0x5c/0x1c0 |
| 144 | [ 2845.743742] [<c0132fd7>] do_softirq+0x57/0x60 |
| 145 | [ 2845.743742] [<c01333dc>] irq_exit+0x7c/0x90 |
| 146 | [ 2845.743742] [<c01055bb>] do_IRQ+0x4b/0x90 |
| 147 | [ 2845.743742] [<c01333d5>] ? irq_exit+0x75/0x90 |
| 148 | [ 2845.743742] [<c010392c>] common_interrupt+0x2c/0x34 |
| 149 | [ 2845.743742] [<c010a14f>] ? mwait_idle+0x4f/0x70 |
| 150 | [ 2845.743742] [<c0101c05>] cpu_idle+0x65/0xb0 |
| 151 | [ 2845.743742] [<c045731e>] rest_init+0x4e/0x60 |
| 152 | [ 2845.743742] ---[ end trace 4c985b38f02227a0 ]--- |
| 153 | [ 2845.743742] ------------[ cut here ]------------ |
| 154 | [ 2845.743742] WARNING: at kernel/smp.c:226 smp_call_function_single+0x8e/0x110() |
| 155 | [ 2845.743742] Hardware name: Dell DM051 |
| 156 | [ 2845.743742] Modules linked in: btusb netconsole snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss rfcomm l2cap bluetooth vfat fuse snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep snd_pcm pl2303 snd_timer psmouse usbserial snd 3c59x e100 serio_raw soundcore i2c_i801 intel_agp mii agpgart snd_page_alloc rtc_cmos rtc_core thermal processor rtc_lib button thermal_sys sg evdev |
| 157 | [ 2845.743742] Pid: 0, comm: swapper Tainted: G D W 2.6.29-rc5-smp #54 |
| 158 | [ 2845.743742] Call Trace: |
| 159 | [ 2845.743742] [<c012e076>] warn_slowpath+0x86/0xa0 |
| 160 | [ 2845.743742] [<c012e000>] ? warn_slowpath+0x10/0xa0 |
| 161 | [ 2845.743742] [<c015041b>] ? trace_hardirqs_off+0xb/0x10 |
| 162 | [ 2845.743742] [<c0146384>] ? up+0x14/0x40 |
| 163 | [ 2845.743742] [<c012e661>] ? release_console_sem+0x31/0x1e0 |
| 164 | [ 2845.743742] [<c046c8ab>] ? _spin_lock_irqsave+0x6b/0x80 |
| 165 | [ 2845.743742] [<c015041b>] ? trace_hardirqs_off+0xb/0x10 |
| 166 | [ 2845.743742] [<c046c900>] ? _read_lock_irqsave+0x40/0x80 |
| 167 | [ 2845.743742] [<c012e7f2>] ? release_console_sem+0x1c2/0x1e0 |
| 168 | [ 2845.743742] [<c0146384>] ? up+0x14/0x40 |
| 169 | [ 2845.743742] [<c015b7be>] smp_call_function_single+0x8e/0x110 |
| 170 | [ 2845.743742] [<c010a1a0>] ? stop_this_cpu+0x0/0x40 |
| 171 | [ 2845.743742] [<c026d23f>] ? cpumask_next_and+0x1f/0x40 |
| 172 | [ 2845.743742] [<c015b95a>] smp_call_function_many+0x11a/0x200 |
| 173 | [ 2845.743742] [<c010a1a0>] ? stop_this_cpu+0x0/0x40 |
| 174 | [ 2845.743742] [<c015ba61>] smp_call_function+0x21/0x30 |
| 175 | [ 2845.743742] [<c01137ae>] native_smp_send_stop+0x1e/0x50 |
| 176 | [ 2845.743742] [<c012e0f5>] panic+0x55/0x110 |
| 177 | [ 2845.743742] [<c01065a8>] oops_end+0xb8/0xc0 |
| 178 | [ 2845.743742] [<c010668f>] die+0x4f/0x70 |
| 179 | [ 2845.743742] [<c011a8c9>] do_page_fault+0x269/0x610 |
| 180 | [ 2845.743742] [<c011a660>] ? do_page_fault+0x0/0x610 |
| 181 | [ 2845.743742] [<c046cbaf>] error_code+0x77/0x7c |
| 182 | [ 2845.743742] [<c015515c>] ? __lock_acquire+0x6c/0xa80 |
| 183 | [ 2845.743742] [<c0153732>] ? trace_hardirqs_on_caller+0x72/0x1c0 |
| 184 | [ 2845.743742] [<c0155be6>] lock_acquire+0x76/0xa0 |
| 185 | [ 2845.743742] [<c03e1aad>] ? skb_dequeue+0x1d/0x70 |
| 186 | [ 2845.743742] [<c046c885>] _spin_lock_irqsave+0x45/0x80 |
| 187 | [ 2845.743742] [<c03e1aad>] ? skb_dequeue+0x1d/0x70 |
| 188 | [ 2845.743742] [<c03e1aad>] skb_dequeue+0x1d/0x70 |
| 189 | [ 2845.743742] [<c03e1f94>] skb_queue_purge+0x14/0x20 |
| 190 | [ 2845.743742] [<f8171f5a>] hci_conn_del+0x10a/0x1c0 [bluetooth] |
| 191 | [ 2845.743742] [<f81399c9>] ? l2cap_disconn_ind+0x59/0xb0 [l2cap] |
| 192 | [ 2845.743742] [<f81795ce>] ? hci_conn_del_sysfs+0x8e/0xd0 [bluetooth] |
| 193 | [ 2845.743742] [<f8175758>] hci_event_packet+0x5f8/0x31c0 [bluetooth] |
| 194 | [ 2845.743742] [<c03dfe19>] ? sock_def_readable+0x59/0x80 |
| 195 | [ 2845.743742] [<c046c14d>] ? _read_unlock+0x1d/0x20 |
| 196 | [ 2845.743742] [<f8178aa9>] ? hci_send_to_sock+0xe9/0x1d0 [bluetooth] |
| 197 | [ 2845.743742] [<c015388b>] ? trace_hardirqs_on+0xb/0x10 |
| 198 | [ 2845.743742] [<f816fa6a>] hci_rx_task+0x2ba/0x490 [bluetooth] |
| 199 | [ 2845.743742] [<c0133661>] ? tasklet_action+0x31/0xc0 |
| 200 | [ 2845.743742] [<c013367c>] tasklet_action+0x4c/0xc0 |
| 201 | [ 2845.743742] [<c0132eb7>] __do_softirq+0xa7/0x170 |
| 202 | [ 2845.743742] [<c0116dec>] ? ack_apic_level+0x5c/0x1c0 |
| 203 | [ 2845.743742] [<c0132fd7>] do_softirq+0x57/0x60 |
| 204 | [ 2845.743742] [<c01333dc>] irq_exit+0x7c/0x90 |
| 205 | [ 2845.743742] [<c01055bb>] do_IRQ+0x4b/0x90 |
| 206 | [ 2845.743742] [<c01333d5>] ? irq_exit+0x75/0x90 |
| 207 | [ 2845.743742] [<c010392c>] common_interrupt+0x2c/0x34 |
| 208 | [ 2845.743742] [<c010a14f>] ? mwait_idle+0x4f/0x70 |
| 209 | [ 2845.743742] [<c0101c05>] cpu_idle+0x65/0xb0 |
| 210 | [ 2845.743742] [<c045731e>] rest_init+0x4e/0x60 |
| 211 | [ 2845.743742] ---[ end trace 4c985b38f02227a1 ]--- |
| 212 | [ 2845.743742] Rebooting in 3 seconds.. |
| 213 | |
| 214 | My logitec bluetooth mouse trying connect to pc, but |
| 215 | pc side reject the connection again and again. then panic happens. |
| 216 | |
| 217 | The reason is due to hci_conn_del_sysfs now called in hci_event_packet, |
| 218 | the del work is done in a workqueue, so it's possible done before |
| 219 | skb_queue_purge called. |
| 220 | |
| 221 | I move the hci_conn_del_sysfs after skb_queue_purge just as that before |
| 222 | marcel's commit. |
| 223 | |
| 224 | Remove the hci_conn_del_sysfs in hci_conn_hash_flush as well due to |
| 225 | hci_conn_del will deal with the work. |
| 226 | |
| 227 | Signed-off-by: Dave Young <hidave.darkstar@gmail.com> |
| 228 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 229 | |
| 230 | commit 2526d3d8b2f671a7d36cc486af984052cd5a690f |
| 231 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 232 | Date: Fri Feb 20 20:54:06 2009 +0100 |
| 233 | |
| 234 | Bluetooth: Permit BT_SECURITY also for L2CAP raw sockets |
| 235 | |
| 236 | Userspace pairing code can be simplified if it doesn't have to fall |
| 237 | back to using L2CAP_LM in the case of L2CAP raw sockets. This patch |
| 238 | allows the BT_SECURITY socket option to be used for these sockets. |
| 239 | |
| 240 | Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com> |
| 241 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 242 | |
| 243 | commit 37e62f5516cfb210e64fe53457932df4341b0ad1 |
| 244 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 245 | Date: Tue Feb 17 21:49:33 2009 +0100 |
| 246 | |
| 247 | Bluetooth: Fix RFCOMM usage of in-kernel L2CAP sockets |
| 248 | |
| 249 | The CID value of L2CAP sockets need to be set to zero. All userspace |
| 250 | applications do this via memset() on the sockaddr_l2 structure. The |
| 251 | RFCOMM implementation uses in-kernel L2CAP sockets and so it has to |
| 252 | make sure that l2_cid is set to zero. |
| 253 | |
| 254 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 255 | |
| 256 | commit 2a517ca687232adc8f14893730644da712010ffc |
| 257 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 258 | Date: Mon Feb 16 03:20:31 2009 +0100 |
| 259 | |
| 260 | Bluetooth: Disallow usage of L2CAP CID setting for now |
| 261 | |
| 262 | In the future the L2CAP layer will have full support for fixed channels |
| 263 | and right now it already can export the channel assignment, but for the |
| 264 | functions bind() and connect() the usage of only CID 0 is allowed. This |
| 265 | allows an easy detection if the kernel supports fixed channels or not, |
| 266 | because otherwise it would impossible for application to tell. |
| 267 | |
| 268 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 269 | |
| 270 | commit 8bf4794174659b06d43cc5e290cd384757374613 |
| 271 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 272 | Date: Mon Feb 16 02:59:49 2009 +0100 |
| 273 | |
| 274 | Bluetooth: Change RFCOMM to use BT_CONNECT2 for BT_DEFER_SETUP |
| 275 | |
| 276 | When BT_DEFER_SETUP is enabled on a RFCOMM socket, then switch its |
| 277 | current state from BT_OPEN to BT_CONNECT2. This gives the Bluetooth |
| 278 | core a unified way to handle L2CAP and RFCOMM sockets. The BT_CONNECT2 |
| 279 | state is designated for incoming connections. |
| 280 | |
| 281 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 282 | |
| 283 | commit d5f2d2be68876f65dd051b978a7b66265fde9ffd |
| 284 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 285 | Date: Mon Feb 16 02:57:30 2009 +0100 |
| 286 | |
| 287 | Bluetooth: Fix poll() misbehavior when using BT_DEFER_SETUP |
| 288 | |
| 289 | When BT_DEFER_SETUP has been enabled on a Bluetooth socket it keeps |
| 290 | signaling POLLIN all the time. This is a wrong behavior. The POLLIN |
| 291 | should only be signaled if the client socket is in BT_CONNECT2 state |
| 292 | and the parent has been BT_DEFER_SETUP enabled. |
| 293 | |
| 294 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 295 | |
| 296 | commit 96a3183322cba1a2846771b067c99b9d6f481263 |
| 297 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 298 | Date: Thu Feb 12 16:23:03 2009 +0100 |
| 299 | |
| 300 | Bluetooth: Set authentication requirement before requesting it |
| 301 | |
| 302 | The authentication requirement got only updated when the security level |
| 303 | increased. This is a wrong behavior. The authentication requirement is |
| 304 | read by the Bluetooth daemon to make proper decisions when handling the |
| 305 | IO capabilities exchange. So set the value that is currently expected by |
| 306 | the higher layers like L2CAP and RFCOMM. |
| 307 | |
| 308 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 309 | |
| 310 | commit 00ae4af91d8c5b6814e2bb3bfaaf743845f989eb |
| 311 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 312 | Date: Thu Feb 12 16:19:45 2009 +0100 |
| 313 | |
| 314 | Bluetooth: Fix authentication requirements for L2CAP security check |
| 315 | |
| 316 | The L2CAP layer can trigger the authentication via an ACL connection or |
| 317 | later on to increase the security level. When increasing the security |
| 318 | level it didn't use the same authentication requirements when triggering |
| 319 | a new ACL connection. Make sure that exactly the same authentication |
| 320 | requirements are used. The only exception here are the L2CAP raw sockets |
| 321 | which are only used for dedicated bonding. |
| 322 | |
| 323 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 324 | |
| 325 | commit 2950f21acb0f6b8fcd964485c2ebf1e06545ac20 |
| 326 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 327 | Date: Thu Feb 12 14:02:50 2009 +0100 |
| 328 | |
| 329 | Bluetooth: Ask upper layers for HCI disconnect reason |
| 330 | |
| 331 | Some of the qualification tests demand that in case of failures in L2CAP |
| 332 | the HCI disconnect should indicate a reason why L2CAP fails. This is a |
| 333 | bluntly layer violation since multiple L2CAP connections could be using |
| 334 | the same ACL and thus forcing a disconnect reason is not a good idea. |
| 335 | |
| 336 | To comply with the Bluetooth test specification, the disconnect reason |
| 337 | is now stored in the L2CAP connection structure and every time a new |
| 338 | L2CAP channel is added it will set back to its default. So only in the |
| 339 | case where the L2CAP channel with the disconnect reason is really the |
| 340 | last one, it will propagated to the HCI layer. |
| 341 | |
| 342 | The HCI layer has been extended with a disconnect indication that allows |
| 343 | it to ask upper layers for a disconnect reason. The upper layer must not |
| 344 | support this callback and in that case it will nicely default to the |
| 345 | existing behavior. If an upper layer like L2CAP can provide a disconnect |
| 346 | reason that one will be used to disconnect the ACL or SCO link. |
| 347 | |
| 348 | No modification to the ACL disconnect timeout have been made. So in case |
| 349 | of Linux to Linux connection the initiator will disconnect the ACL link |
| 350 | before the acceptor side can signal the specific disconnect reason. That |
| 351 | is perfectly fine since Linux doesn't make use of this value anyway. The |
| 352 | L2CAP layer has a perfect valid error code for rejecting connection due |
| 353 | to a security violation. It is unclear why the Bluetooth specification |
| 354 | insists on having specific HCI disconnect reason. |
| 355 | |
| 356 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 357 | |
| 358 | commit f29972de8e7476706ab3c01304a505e7c95d9040 |
| 359 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 360 | Date: Thu Feb 12 05:07:45 2009 +0100 |
| 361 | |
| 362 | Bluetooth: Add CID field to L2CAP socket address structure |
| 363 | |
| 364 | In preparation for L2CAP fixed channel support, the CID value of a |
| 365 | L2CAP connection needs to be accessible via the socket interface. The |
| 366 | CID is the connection identifier and exists as source and destination |
| 367 | value. So extend the L2CAP socket address structure with this field and |
| 368 | change getsockname() and getpeername() to fill it in. |
| 369 | |
| 370 | The bind() and connect() functions have been modified to handle L2CAP |
| 371 | socket address structures of variable sizes. This makes them future |
| 372 | proof if additional fields need to be added. |
| 373 | |
| 374 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 375 | |
| 376 | commit e1027a7c69700301d14db03d2e049ee60c4f92df |
| 377 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 378 | Date: Mon Feb 9 09:18:02 2009 +0100 |
| 379 | |
| 380 | Bluetooth: Request L2CAP fixed channel list if available |
| 381 | |
| 382 | If the extended features mask indicates support for fixed channels, |
| 383 | request the list of available fixed channels. This also enables the |
| 384 | fixed channel features bit so remote implementations can request |
| 385 | information about it. Currently only the signal channel will be |
| 386 | listed. |
| 387 | |
| 388 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 389 | |
| 390 | commit 435fef20acfc48f46476abad55b0cd3aa47b8365 |
| 391 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 392 | Date: Mon Feb 9 03:55:28 2009 +0100 |
| 393 | |
| 394 | Bluetooth: Don't enforce authentication for L2CAP PSM 1 and 3 |
| 395 | |
| 396 | The recommendation for the L2CAP PSM 1 (SDP) is to not use any kind |
| 397 | of authentication or encryption. So don't trigger authentication |
| 398 | for incoming and outgoing SDP connections. |
| 399 | |
| 400 | For L2CAP PSM 3 (RFCOMM) there is no clear requirement, but with |
| 401 | Bluetooth 2.1 the initiator is required to enable authentication |
| 402 | and encryption first and this gets enforced. So there is no need |
| 403 | to trigger an additional authentication step. The RFCOMM service |
| 404 | security will make sure that a secure enough link key is present. |
| 405 | |
| 406 | When the encryption gets enabled after the SDP connection setup, |
| 407 | then switch the security level from SDP to low security. |
| 408 | |
| 409 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 410 | |
| 411 | commit 6a8d3010b313d99adbb28f1826fac0234395bb26 |
| 412 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 413 | Date: Fri Feb 6 23:56:36 2009 +0100 |
| 414 | |
| 415 | Bluetooth: Fix double L2CAP connection request |
| 416 | |
| 417 | If the remote L2CAP server uses authentication pending stage and |
| 418 | encryption is enabled it can happen that a L2CAP connection request is |
| 419 | sent twice due to a race condition in the connection state machine. |
| 420 | |
| 421 | When the remote side indicates any kind of connection pending, then |
| 422 | track this state and skip sending of L2CAP commands for this period. |
| 423 | |
| 424 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 425 | |
| 426 | commit 984947dc64f82bc6cafa4d84ba1a139718f634a8 |
| 427 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 428 | Date: Fri Feb 6 23:35:19 2009 +0100 |
| 429 | |
| 430 | Bluetooth: Fix race condition with L2CAP information request |
| 431 | |
| 432 | When two L2CAP connections are requested quickly after the ACL link has |
| 433 | been established there exists a window for a race condition where a |
| 434 | connection request is sent before the information response has been |
| 435 | received. Any connection request should only be sent after an exchange |
| 436 | of the extended features mask has been finished. |
| 437 | |
| 438 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 439 | |
| 440 | commit 657e17b03c80bec817975984d221bef716f83558 |
| 441 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 442 | Date: Fri Feb 6 19:45:36 2009 +0100 |
| 443 | |
| 444 | Bluetooth: Set authentication requirements if not available |
| 445 | |
| 446 | When no authentication requirements are selected, but an outgoing or |
| 447 | incoming connection has requested any kind of security enforcement, |
| 448 | then set these authentication requirements. |
| 449 | |
| 450 | This ensures that the userspace always gets informed about the |
| 451 | authentication requirements (if available). Only when no security |
| 452 | enforcement has happened, the kernel will signal invalid requirements. |
| 453 | |
| 454 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 455 | |
| 456 | commit 0684e5f9fb9e3f7e168ab831dfca693bcb44805b |
| 457 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 458 | Date: Mon Feb 9 02:48:38 2009 +0100 |
| 459 | |
| 460 | Bluetooth: Use general bonding whenever possible |
| 461 | |
| 462 | When receiving incoming connection to specific services, always use |
| 463 | general bonding. This ensures that the link key gets stored and can be |
| 464 | used for further authentications. |
| 465 | |
| 466 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 467 | |
| 468 | commit efc7688b557dd1be10eead7399b315efcb1dbc74 |
| 469 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 470 | Date: Fri Feb 6 09:13:37 2009 +0100 |
| 471 | |
| 472 | Bluetooth: Add SCO fallback for eSCO connection attempts |
| 473 | |
| 474 | When attempting to setup eSCO connections it can happen that some link |
| 475 | manager implementations fail to properly negotiate the eSCO parameters |
| 476 | and thus fail the eSCO setup. Normally the link manager is responsible |
| 477 | for the negotiation of the parameters and actually fallback to SCO if |
| 478 | no agreement can be reached. In cases where the link manager is just too |
| 479 | stupid, then at least try to establish a SCO link if eSCO fails. |
| 480 | |
| 481 | For the Bluetooth devices with EDR support this includes handling packet |
| 482 | types of EDR basebands. This is particular tricky since for the EDR the |
| 483 | logic of enabling/disabling one specific packet type is turned around. |
| 484 | This fix contains an extra bitmask to disable eSCO EDR packet when |
| 485 | trying to fallback to a SCO connection. |
| 486 | |
| 487 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 488 | |
| 489 | commit 255c76014af74165428e7aa16414b857e2bdccf2 |
| 490 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 491 | Date: Wed Feb 4 21:07:19 2009 +0100 |
| 492 | |
| 493 | Bluetooth: Don't check encryption for L2CAP raw sockets |
| 494 | |
| 495 | For L2CAP sockets with medium and high security requirement a missing |
| 496 | encryption will enforce the closing of the link. For the L2CAP raw |
| 497 | sockets this is not needed, so skip that check. |
| 498 | |
| 499 | This fixes a crash when pairing Bluetooth 2.0 (and earlier) devices |
| 500 | since the L2CAP state machine got confused and then locked up the whole |
| 501 | system. |
| 502 | |
| 503 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 504 | |
| 505 | commit 43c2e57f94c15744495fee564610aa24602b3824 |
| 506 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 507 | Date: Wed Feb 4 17:41:38 2009 +0100 |
| 508 | |
| 509 | Bluetooth: Submit bulk URBs along with interrupt URBs |
| 510 | |
| 511 | Submitting the bulk URBs for ACL data transfers only on demand has no |
| 512 | real benefit compared to just submit them when a Bluetooth device gets |
| 513 | opened. So when submitting the interrupt URBs for HCI events, just |
| 514 | submit the bulk URBs, too. |
| 515 | |
| 516 | This solves a problem with some Bluetooth USB dongles that has been |
| 517 | reported over the last few month. These devices require that the bulk |
| 518 | URBs are actually present. These devices are really broken, but there |
| 519 | is nothing we can do about it. |
| 520 | |
| 521 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 522 | |
| 523 | commit 6e1031a40029492c10509e8c3dcac9b611438ccb |
| 524 | Author: Jaikumar Ganesh <jaikumar@google.com> |
| 525 | Date: Mon Feb 2 18:03:57 2009 -0800 |
| 526 | |
| 527 | Bluetooth: When encryption is dropped, do not send RFCOMM packets |
| 528 | |
| 529 | During a role change with pre-Bluetooth 2.1 devices, the remote side drops |
| 530 | the encryption of the RFCOMM connection. We allow a grace period for the |
| 531 | encryption to be re-established, before dropping the connection. During |
| 532 | this grace period, the RFCOMM_SEC_PENDING flag is set. Check this flag |
| 533 | before sending RFCOMM packets. |
| 534 | |
| 535 | Signed-off-by: Jaikumar Ganesh <jaikumar@google.com> |
| 536 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 537 | |
| 538 | commit 34a55eda483e8177c9044f93fd2c9107f02bf1c7 |
| 539 | Author: Andre Haupt <andre@bitwigglers.org> |
| 540 | Date: Mon Feb 2 14:45:11 2009 -0800 |
| 541 | |
| 542 | Bluetooth: Eliminate a sparse warning in bt3c driver |
| 543 | |
| 544 | This eliminates a sparse warning that symbol 'stat' shadows an earlier one. |
| 545 | |
| 546 | Signed-off-by: Andre Haupt <andre@bitwigglers.org> |
| 547 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 548 | |
| 549 | commit dd2efd03b49d56ae795c71335bc7358022514c32 |
| 550 | Author: Dave Young <hidave.darkstar@gmail.com> |
| 551 | Date: Sat Jan 31 13:51:15 2009 +0800 |
| 552 | |
| 553 | Bluetooth: Remove CONFIG_DEBUG_LOCK_ALLOC ifdefs |
| 554 | |
| 555 | Due to lockdep changes, the CONFIG_DEBUG_LOCK_ALLOC ifdef is not needed |
| 556 | now. So just remove it here. |
| 557 | |
| 558 | The following commit fixed the !lockdep build warnings: |
| 559 | |
| 560 | commit e8f6fbf62de37cbc2e179176ac7010d5f4396b67 |
| 561 | Author: Ingo Molnar <mingo@elte.hu> |
| 562 | Date: Wed Nov 12 01:38:36 2008 +0000 |
| 563 | |
| 564 | lockdep: include/linux/lockdep.h - fix warning in net/bluetooth/af_bluetooth.c |
| 565 | |
| 566 | Signed-off-by: Dave Young <hidave.darkstar@gmail.com> |
| 567 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 568 | |
| 569 | commit 5f9018af004fa8635bbbe3ab2dc61e8a686edfaa |
| 570 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 571 | Date: Fri Jan 16 10:09:50 2009 +0100 |
| 572 | |
| 573 | Bluetooth: Update version numbers |
| 574 | |
| 575 | With the support for the enhanced security model and the support for |
| 576 | deferring connection setup, it is a good idea to increase various |
| 577 | version numbers. |
| 578 | |
| 579 | This is purely cosmetic and has no effect on the behavior, but can |
| 580 | be really helpful when debugging problems in different kernel versions. |
| 581 | |
| 582 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 583 | |
| 584 | commit 0588d94fd7e414367a7ae517569d2222441c255f |
| 585 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 586 | Date: Fri Jan 16 10:06:13 2009 +0100 |
| 587 | |
| 588 | Bluetooth: Restrict application of socket options |
| 589 | |
| 590 | The new socket options should only be evaluated for SOL_BLUETOOTH level |
| 591 | and not for every other level. Previously this causes some minor issues |
| 592 | when detecting if a kernel with certain features is available. |
| 593 | |
| 594 | Also restrict BT_SECURITY to SOCK_SEQPACKET for L2CAP and SOCK_STREAM for |
| 595 | the RFCOMM protocol. |
| 596 | |
| 597 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 598 | |
| 599 | commit f62e4323ab43c59e7cd7f72c1eb392d7c767ce5a |
| 600 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 601 | Date: Thu Jan 15 21:58:44 2009 +0100 |
| 602 | |
| 603 | Bluetooth: Disconnect L2CAP connections without encryption |
| 604 | |
| 605 | For L2CAP connections with high security setting, the link will be |
| 606 | immediately dropped when the encryption gets disabled. For L2CAP |
| 607 | connections with medium security there will be grace period where |
| 608 | the remote device has the chance to re-enable encryption. If it |
| 609 | doesn't happen then the link will also be disconnected. |
| 610 | |
| 611 | The requirement for the grace period with medium security comes from |
| 612 | Bluetooth 2.0 and earlier devices that require role switching. |
| 613 | |
| 614 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 615 | |
| 616 | commit 8c84b83076b5062f59b6167cdda90d9e5124aa71 |
| 617 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 618 | Date: Fri Jan 16 08:17:51 2009 +0100 |
| 619 | |
| 620 | Bluetooth: Pause RFCOMM TX when encryption drops |
| 621 | |
| 622 | A role switch with devices following the Bluetooth pre-2.1 standards |
| 623 | or without Encryption Pause and Resume support is not possible if |
| 624 | encryption is enabled. Most newer headsets require the role switch, |
| 625 | but also require that the connection is encrypted. |
| 626 | |
| 627 | For connections with a high security mode setting, the link will be |
| 628 | immediately dropped. When the connection uses medium security mode |
| 629 | setting, then a grace period is introduced where the TX is halted and |
| 630 | the remote device gets a change to re-enable encryption after the |
| 631 | role switch. If not re-enabled the link will be dropped. |
| 632 | |
| 633 | Based on initial work by Ville Tervo <ville.tervo@nokia.com> |
| 634 | |
| 635 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 636 | |
| 637 | commit 9f2c8a03fbb3048cf38b158f87aa0c3c09bca084 |
| 638 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 639 | Date: Thu Jan 15 21:58:40 2009 +0100 |
| 640 | |
| 641 | Bluetooth: Replace RFCOMM link mode with security level |
| 642 | |
| 643 | Change the RFCOMM internals to use the new security levels and remove |
| 644 | the link mode details. |
| 645 | |
| 646 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 647 | |
| 648 | commit 2af6b9d518ddfbc4d6990d5f9c9b1a05341c1cef |
| 649 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 650 | Date: Thu Jan 15 21:58:38 2009 +0100 |
| 651 | |
| 652 | Bluetooth: Replace L2CAP link mode with security level |
| 653 | |
| 654 | Change the L2CAP internals to use the new security levels and remove |
| 655 | the link mode details. |
| 656 | |
| 657 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 658 | |
| 659 | commit 8c1b235594fbab9a13240a1dac12ea9fd99b6440 |
| 660 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 661 | Date: Thu Jan 15 21:58:04 2009 +0100 |
| 662 | |
| 663 | Bluetooth: Add enhanced security model for Simple Pairing |
| 664 | |
| 665 | The current security model is based around the flags AUTH, ENCRYPT and |
| 666 | SECURE. Starting with support for the Bluetooth 2.1 specification this is |
| 667 | no longer sufficient. The different security levels are now defined as |
| 668 | SDP, LOW, MEDIUM and SECURE. |
| 669 | |
| 670 | Previously it was possible to set each security independently, but this |
| 671 | actually doesn't make a lot of sense. For Bluetooth the encryption depends |
| 672 | on a previous successful authentication. Also you can only update your |
| 673 | existing link key if you successfully created at least one before. And of |
| 674 | course the update of link keys without having proper encryption in place |
| 675 | is a security issue. |
| 676 | |
| 677 | The new security levels from the Bluetooth 2.1 specification are now |
| 678 | used internally. All old settings are mapped to the new values and this |
| 679 | way it ensures that old applications still work. The only limitation |
| 680 | is that it is no longer possible to set authentication without also |
| 681 | enabling encryption. No application should have done this anyway since |
| 682 | this is actually a security issue. Without encryption the integrity of |
| 683 | the authentication can't be guaranteed. |
| 684 | |
| 685 | As default for a new L2CAP or RFCOMM connection, the LOW security level |
| 686 | is used. The only exception here are the service discovery sessions on |
| 687 | PSM 1 where SDP level is used. To have similar security strength as with |
| 688 | a Bluetooth 2.0 and before combination key, the MEDIUM level should be |
| 689 | used. This is according to the Bluetooth specification. The MEDIUM level |
| 690 | will not require any kind of man-in-the-middle (MITM) protection. Only |
| 691 | the HIGH security level will require this. |
| 692 | |
| 693 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 694 | |
| 695 | commit c89b6e6bda4c8021195778f47567d0cc9dbfe7ec |
| 696 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 697 | Date: Thu Jan 15 21:57:03 2009 +0100 |
| 698 | |
| 699 | Bluetooth: Fix SCO state handling for incoming connections |
| 700 | |
| 701 | When the remote device supports only SCO connections, on receipt of |
| 702 | the HCI_EV_CONN_COMPLETE event packet, the connect state is changed to |
| 703 | BT_CONNECTED, but the socket state is not updated. Hence, the connect() |
| 704 | call times out even though the SCO connection has been successfully |
| 705 | established. |
| 706 | |
| 707 | Based on a report by Jaikumar Ganesh <jaikumar@google.com> |
| 708 | |
| 709 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 710 | |
| 711 | commit 71aeeaa1fd88fe7446391e0553336f0e0c2cfe6a |
| 712 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 713 | Date: Thu Jan 15 21:57:02 2009 +0100 |
| 714 | |
| 715 | Bluetooth: Reject incoming SCO connections without listeners |
| 716 | |
| 717 | All SCO and eSCO connection are auto-accepted no matter if there is a |
| 718 | corresponding listening socket for them. This patch changes this and |
| 719 | connection requests for SCO and eSCO without any socket are rejected. |
| 720 | |
| 721 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 722 | |
| 723 | commit f66dc81f44d918ee1aa1a9d821bb2f25c7592bc0 |
| 724 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 725 | Date: Thu Jan 15 21:57:00 2009 +0100 |
| 726 | |
| 727 | Bluetooth: Add support for deferring L2CAP connection setup |
| 728 | |
| 729 | In order to decide if listening L2CAP sockets should be accept()ed |
| 730 | the BD_ADDR of the remote device needs to be known. This patch adds |
| 731 | a socket option which defines a timeout for deferring the actual |
| 732 | connection setup. |
| 733 | |
| 734 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 735 | |
| 736 | commit bb23c0ab824653be4aa7dfca15b07b3059717004 |
| 737 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 738 | Date: Thu Jan 15 21:56:48 2009 +0100 |
| 739 | |
| 740 | Bluetooth: Add support for deferring RFCOMM connection setup |
| 741 | |
| 742 | In order to decide if listening RFCOMM sockets should be accept()ed |
| 743 | the BD_ADDR of the remote device needs to be known. This patch adds |
| 744 | a socket option which defines a timeout for deferring the actual |
| 745 | connection setup. |
| 746 | |
| 747 | The connection setup is done after reading from the socket for the |
| 748 | first time. Until then writing to the socket returns ENOTCONN. |
| 749 | |
| 750 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 751 | |
| 752 | commit c4f912e155504e94dd4f3d63c378dab0ff03dbda |
| 753 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 754 | Date: Thu Jan 15 21:52:16 2009 +0100 |
| 755 | |
| 756 | Bluetooth: Add global deferred socket parameter |
| 757 | |
| 758 | The L2CAP and RFCOMM applications require support for authorization |
| 759 | and the ability of rejecting incoming connection requests. The socket |
| 760 | interface is not really able to support this. |
| 761 | |
| 762 | This patch does the ground work for a socket option to defer connection |
| 763 | setup. Setting this option allows calling of accept() and then the |
| 764 | first read() will trigger the final connection setup. Calling close() |
| 765 | would reject the connection. |
| 766 | |
| 767 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 768 | |
| 769 | commit d58daf42d29a3a4a4d4be46cf47ceee096789680 |
| 770 | Author: Marcel Holtmann <marcel@holtmann.org> |
| 771 | Date: Thu Jan 15 21:52:14 2009 +0100 |
| 772 | |
| 773 | Bluetooth: Preparation for usage of SOL_BLUETOOTH |
| 774 | |
| 775 | The socket option levels SOL_L2CAP, SOL_RFOMM and SOL_SCO are currently |
| 776 | in use by various Bluetooth applications. Going forward the common |
| 777 | option level SOL_BLUETOOTH should be used. This patch prepares the clean |
| 778 | split of the old and new option levels while keeping everything backward |
| 779 | compatibility. |
| 780 | |
| 781 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 782 | |
| 783 | commit 91aa35a5aa3540223066bf6b51c935418c63a35d |
| 784 | Author: Victor Shcherbatyuk <victor.shcherbatyuk@tomtom.com> |
| 785 | Date: Thu Jan 15 21:52:12 2009 +0100 |
| 786 | |
| 787 | Bluetooth: Fix issue with return value of rfcomm_sock_sendmsg() |
| 788 | |
| 789 | In case of connection failures the rfcomm_sock_sendmsg() should return |
| 790 | an error and not a 0 value. |
| 791 | |
| 792 | Signed-off-by: Victor Shcherbatyuk <victor.shcherbatyuk@tomtom.com> |
| 793 | Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| 794 | |
| 795 | diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c |
| 796 | index d3f14be..2a00707 100644 |
| 797 | --- a/drivers/bluetooth/bfusb.c |
| 798 | +++ b/drivers/bluetooth/bfusb.c |
| 799 | @@ -257,8 +257,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch |
| 800 | |
| 801 | if (hdr & 0x10) { |
| 802 | BT_ERR("%s error in block", data->hdev->name); |
| 803 | - if (data->reassembly) |
| 804 | - kfree_skb(data->reassembly); |
| 805 | + kfree_skb(data->reassembly); |
| 806 | data->reassembly = NULL; |
| 807 | return -EIO; |
| 808 | } |
| 809 | diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c |
| 810 | index ff195c2..d58e22b 100644 |
| 811 | --- a/drivers/bluetooth/bt3c_cs.c |
| 812 | +++ b/drivers/bluetooth/bt3c_cs.c |
| 813 | @@ -359,9 +359,9 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst) |
| 814 | BT_ERR("Very strange (stat=0x%04x)", stat); |
| 815 | } else if ((stat & 0xff) != 0xff) { |
| 816 | if (stat & 0x0020) { |
| 817 | - int stat = bt3c_read(iobase, 0x7002) & 0x10; |
| 818 | + int status = bt3c_read(iobase, 0x7002) & 0x10; |
| 819 | BT_INFO("%s: Antenna %s", info->hdev->name, |
| 820 | - stat ? "out" : "in"); |
| 821 | + status ? "out" : "in"); |
| 822 | } |
| 823 | if (stat & 0x0001) |
| 824 | bt3c_receive(info); |
| 825 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
| 826 | index b5fbda6..e70c57e 100644 |
| 827 | --- a/drivers/bluetooth/btusb.c |
| 828 | +++ b/drivers/bluetooth/btusb.c |
| 829 | @@ -35,7 +35,7 @@ |
| 830 | #include <net/bluetooth/bluetooth.h> |
| 831 | #include <net/bluetooth/hci_core.h> |
| 832 | |
| 833 | -#define VERSION "0.4" |
| 834 | +#define VERSION "0.5" |
| 835 | |
| 836 | static int ignore_dga; |
| 837 | static int ignore_csr; |
| 838 | @@ -171,6 +171,7 @@ struct btusb_data { |
| 839 | |
| 840 | __u8 cmdreq_type; |
| 841 | |
| 842 | + unsigned int sco_num; |
| 843 | int isoc_altsetting; |
| 844 | int suspend_count; |
| 845 | }; |
| 846 | @@ -496,11 +497,23 @@ static int btusb_open(struct hci_dev *hdev) |
| 847 | return 0; |
| 848 | |
| 849 | err = btusb_submit_intr_urb(hdev, GFP_KERNEL); |
| 850 | + if (err < 0) |
| 851 | + goto failed; |
| 852 | + |
| 853 | + err = btusb_submit_bulk_urb(hdev, GFP_KERNEL); |
| 854 | if (err < 0) { |
| 855 | - clear_bit(BTUSB_INTR_RUNNING, &data->flags); |
| 856 | - clear_bit(HCI_RUNNING, &hdev->flags); |
| 857 | + usb_kill_anchored_urbs(&data->intr_anchor); |
| 858 | + goto failed; |
| 859 | } |
| 860 | |
| 861 | + set_bit(BTUSB_BULK_RUNNING, &data->flags); |
| 862 | + btusb_submit_bulk_urb(hdev, GFP_KERNEL); |
| 863 | + |
| 864 | + return 0; |
| 865 | + |
| 866 | +failed: |
| 867 | + clear_bit(BTUSB_INTR_RUNNING, &data->flags); |
| 868 | + clear_bit(HCI_RUNNING, &hdev->flags); |
| 869 | return err; |
| 870 | } |
| 871 | |
| 872 | @@ -655,19 +668,10 @@ static void btusb_notify(struct hci_dev *hdev, unsigned int evt) |
| 873 | |
| 874 | BT_DBG("%s evt %d", hdev->name, evt); |
| 875 | |
| 876 | - if (hdev->conn_hash.acl_num > 0) { |
| 877 | - if (!test_and_set_bit(BTUSB_BULK_RUNNING, &data->flags)) { |
| 878 | - if (btusb_submit_bulk_urb(hdev, GFP_ATOMIC) < 0) |
| 879 | - clear_bit(BTUSB_BULK_RUNNING, &data->flags); |
| 880 | - else |
| 881 | - btusb_submit_bulk_urb(hdev, GFP_ATOMIC); |
| 882 | - } |
| 883 | - } else { |
| 884 | - clear_bit(BTUSB_BULK_RUNNING, &data->flags); |
| 885 | - usb_unlink_anchored_urbs(&data->bulk_anchor); |
| 886 | + if (hdev->conn_hash.sco_num != data->sco_num) { |
| 887 | + data->sco_num = hdev->conn_hash.sco_num; |
| 888 | + schedule_work(&data->work); |
| 889 | } |
| 890 | - |
| 891 | - schedule_work(&data->work); |
| 892 | } |
| 893 | |
| 894 | static int inline __set_isoc_interface(struct hci_dev *hdev, int altsetting) |
| 895 | @@ -982,9 +986,11 @@ static int btusb_resume(struct usb_interface *intf) |
| 896 | } |
| 897 | |
| 898 | if (test_bit(BTUSB_BULK_RUNNING, &data->flags)) { |
| 899 | - if (btusb_submit_bulk_urb(hdev, GFP_NOIO) < 0) |
| 900 | + err = btusb_submit_bulk_urb(hdev, GFP_NOIO); |
| 901 | + if (err < 0) { |
| 902 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); |
| 903 | - else |
| 904 | + return err; |
| 905 | + } else |
| 906 | btusb_submit_bulk_urb(hdev, GFP_NOIO); |
| 907 | } |
| 908 | |
| 909 | diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c |
| 910 | index b0fafb0..c0ce813 100644 |
| 911 | --- a/drivers/bluetooth/hci_h4.c |
| 912 | +++ b/drivers/bluetooth/hci_h4.c |
| 913 | @@ -102,8 +102,7 @@ static int h4_close(struct hci_uart *hu) |
| 914 | |
| 915 | skb_queue_purge(&h4->txq); |
| 916 | |
| 917 | - if (h4->rx_skb) |
| 918 | - kfree_skb(h4->rx_skb); |
| 919 | + kfree_skb(h4->rx_skb); |
| 920 | |
| 921 | hu->priv = NULL; |
| 922 | kfree(h4); |
| 923 | diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c |
| 924 | index b91d45a..5c65014 100644 |
| 925 | --- a/drivers/bluetooth/hci_ll.c |
| 926 | +++ b/drivers/bluetooth/hci_ll.c |
| 927 | @@ -163,8 +163,7 @@ static int ll_close(struct hci_uart *hu) |
| 928 | skb_queue_purge(&ll->tx_wait_q); |
| 929 | skb_queue_purge(&ll->txq); |
| 930 | |
| 931 | - if (ll->rx_skb) |
| 932 | - kfree_skb(ll->rx_skb); |
| 933 | + kfree_skb(ll->rx_skb); |
| 934 | |
| 935 | hu->priv = NULL; |
| 936 | |
| 937 | diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h |
| 938 | index a04f846..3ad5390 100644 |
| 939 | --- a/include/net/bluetooth/bluetooth.h |
| 940 | +++ b/include/net/bluetooth/bluetooth.h |
| 941 | @@ -53,6 +53,17 @@ |
| 942 | #define SOL_SCO 17 |
| 943 | #define SOL_RFCOMM 18 |
| 944 | |
| 945 | +#define BT_SECURITY 4 |
| 946 | +struct bt_security { |
| 947 | + __u8 level; |
| 948 | +}; |
| 949 | +#define BT_SECURITY_SDP 0 |
| 950 | +#define BT_SECURITY_LOW 1 |
| 951 | +#define BT_SECURITY_MEDIUM 2 |
| 952 | +#define BT_SECURITY_HIGH 3 |
| 953 | + |
| 954 | +#define BT_DEFER_SETUP 7 |
| 955 | + |
| 956 | #define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) |
| 957 | #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) |
| 958 | #define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) |
| 959 | @@ -108,6 +119,7 @@ struct bt_sock { |
| 960 | bdaddr_t dst; |
| 961 | struct list_head accept_q; |
| 962 | struct sock *parent; |
| 963 | + u32 defer_setup; |
| 964 | }; |
| 965 | |
| 966 | struct bt_sock_list { |
| 967 | diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h |
| 968 | index 3645139..f69f015 100644 |
| 969 | --- a/include/net/bluetooth/hci.h |
| 970 | +++ b/include/net/bluetooth/hci.h |
| 971 | @@ -133,8 +133,13 @@ enum { |
| 972 | #define ESCO_EV3 0x0008 |
| 973 | #define ESCO_EV4 0x0010 |
| 974 | #define ESCO_EV5 0x0020 |
| 975 | +#define ESCO_2EV3 0x0040 |
| 976 | +#define ESCO_3EV3 0x0080 |
| 977 | +#define ESCO_2EV5 0x0100 |
| 978 | +#define ESCO_3EV5 0x0200 |
| 979 | |
| 980 | #define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) |
| 981 | +#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) |
| 982 | |
| 983 | /* ACL flags */ |
| 984 | #define ACL_CONT 0x01 |
| 985 | @@ -176,6 +181,9 @@ enum { |
| 986 | #define LMP_EV5 0x02 |
| 987 | |
| 988 | #define LMP_SNIFF_SUBR 0x02 |
| 989 | +#define LMP_EDR_ESCO_2M 0x20 |
| 990 | +#define LMP_EDR_ESCO_3M 0x40 |
| 991 | +#define LMP_EDR_3S_ESCO 0x80 |
| 992 | |
| 993 | #define LMP_SIMPLE_PAIR 0x08 |
| 994 | |
| 995 | diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h |
| 996 | index 46a43b7..01f9316 100644 |
| 997 | --- a/include/net/bluetooth/hci_core.h |
| 998 | +++ b/include/net/bluetooth/hci_core.h |
| 999 | @@ -169,6 +169,7 @@ struct hci_conn { |
| 1000 | __u16 link_policy; |
| 1001 | __u32 link_mode; |
| 1002 | __u8 auth_type; |
| 1003 | + __u8 sec_level; |
| 1004 | __u8 power_save; |
| 1005 | unsigned long pend; |
| 1006 | |
| 1007 | @@ -325,12 +326,11 @@ int hci_conn_del(struct hci_conn *conn); |
| 1008 | void hci_conn_hash_flush(struct hci_dev *hdev); |
| 1009 | void hci_conn_check_pending(struct hci_dev *hdev); |
| 1010 | |
| 1011 | -struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 auth_type); |
| 1012 | +struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type); |
| 1013 | int hci_conn_check_link_mode(struct hci_conn *conn); |
| 1014 | -int hci_conn_auth(struct hci_conn *conn); |
| 1015 | -int hci_conn_encrypt(struct hci_conn *conn); |
| 1016 | +int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); |
| 1017 | int hci_conn_change_link_key(struct hci_conn *conn); |
| 1018 | -int hci_conn_switch_role(struct hci_conn *conn, uint8_t role); |
| 1019 | +int hci_conn_switch_role(struct hci_conn *conn, __u8 role); |
| 1020 | |
| 1021 | void hci_conn_enter_active_mode(struct hci_conn *conn); |
| 1022 | void hci_conn_enter_sniff_mode(struct hci_conn *conn); |
| 1023 | @@ -470,26 +470,26 @@ void hci_conn_del_sysfs(struct hci_conn *conn); |
| 1024 | |
| 1025 | /* ----- HCI protocols ----- */ |
| 1026 | struct hci_proto { |
| 1027 | - char *name; |
| 1028 | + char *name; |
| 1029 | unsigned int id; |
| 1030 | unsigned long flags; |
| 1031 | |
| 1032 | void *priv; |
| 1033 | |
| 1034 | - int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type); |
| 1035 | + int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type); |
| 1036 | int (*connect_cfm) (struct hci_conn *conn, __u8 status); |
| 1037 | - int (*disconn_ind) (struct hci_conn *conn, __u8 reason); |
| 1038 | + int (*disconn_ind) (struct hci_conn *conn); |
| 1039 | + int (*disconn_cfm) (struct hci_conn *conn, __u8 reason); |
| 1040 | int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb, __u16 flags); |
| 1041 | int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb); |
| 1042 | - int (*auth_cfm) (struct hci_conn *conn, __u8 status); |
| 1043 | - int (*encrypt_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt); |
| 1044 | + int (*security_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt); |
| 1045 | }; |
| 1046 | |
| 1047 | static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type) |
| 1048 | { |
| 1049 | register struct hci_proto *hp; |
| 1050 | int mask = 0; |
| 1051 | - |
| 1052 | + |
| 1053 | hp = hci_proto[HCI_PROTO_L2CAP]; |
| 1054 | if (hp && hp->connect_ind) |
| 1055 | mask |= hp->connect_ind(hdev, bdaddr, type); |
| 1056 | @@ -514,30 +514,52 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status) |
| 1057 | hp->connect_cfm(conn, status); |
| 1058 | } |
| 1059 | |
| 1060 | -static inline void hci_proto_disconn_ind(struct hci_conn *conn, __u8 reason) |
| 1061 | +static inline int hci_proto_disconn_ind(struct hci_conn *conn) |
| 1062 | { |
| 1063 | register struct hci_proto *hp; |
| 1064 | + int reason = 0x13; |
| 1065 | |
| 1066 | hp = hci_proto[HCI_PROTO_L2CAP]; |
| 1067 | if (hp && hp->disconn_ind) |
| 1068 | - hp->disconn_ind(conn, reason); |
| 1069 | + reason = hp->disconn_ind(conn); |
| 1070 | |
| 1071 | hp = hci_proto[HCI_PROTO_SCO]; |
| 1072 | if (hp && hp->disconn_ind) |
| 1073 | - hp->disconn_ind(conn, reason); |
| 1074 | + reason = hp->disconn_ind(conn); |
| 1075 | + |
| 1076 | + return reason; |
| 1077 | +} |
| 1078 | + |
| 1079 | +static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason) |
| 1080 | +{ |
| 1081 | + register struct hci_proto *hp; |
| 1082 | + |
| 1083 | + hp = hci_proto[HCI_PROTO_L2CAP]; |
| 1084 | + if (hp && hp->disconn_cfm) |
| 1085 | + hp->disconn_cfm(conn, reason); |
| 1086 | + |
| 1087 | + hp = hci_proto[HCI_PROTO_SCO]; |
| 1088 | + if (hp && hp->disconn_cfm) |
| 1089 | + hp->disconn_cfm(conn, reason); |
| 1090 | } |
| 1091 | |
| 1092 | static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) |
| 1093 | { |
| 1094 | register struct hci_proto *hp; |
| 1095 | + __u8 encrypt; |
| 1096 | + |
| 1097 | + if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) |
| 1098 | + return; |
| 1099 | + |
| 1100 | + encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; |
| 1101 | |
| 1102 | hp = hci_proto[HCI_PROTO_L2CAP]; |
| 1103 | - if (hp && hp->auth_cfm) |
| 1104 | - hp->auth_cfm(conn, status); |
| 1105 | + if (hp && hp->security_cfm) |
| 1106 | + hp->security_cfm(conn, status, encrypt); |
| 1107 | |
| 1108 | hp = hci_proto[HCI_PROTO_SCO]; |
| 1109 | - if (hp && hp->auth_cfm) |
| 1110 | - hp->auth_cfm(conn, status); |
| 1111 | + if (hp && hp->security_cfm) |
| 1112 | + hp->security_cfm(conn, status, encrypt); |
| 1113 | } |
| 1114 | |
| 1115 | static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) |
| 1116 | @@ -545,12 +567,12 @@ static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u |
| 1117 | register struct hci_proto *hp; |
| 1118 | |
| 1119 | hp = hci_proto[HCI_PROTO_L2CAP]; |
| 1120 | - if (hp && hp->encrypt_cfm) |
| 1121 | - hp->encrypt_cfm(conn, status, encrypt); |
| 1122 | + if (hp && hp->security_cfm) |
| 1123 | + hp->security_cfm(conn, status, encrypt); |
| 1124 | |
| 1125 | hp = hci_proto[HCI_PROTO_SCO]; |
| 1126 | - if (hp && hp->encrypt_cfm) |
| 1127 | - hp->encrypt_cfm(conn, status, encrypt); |
| 1128 | + if (hp && hp->security_cfm) |
| 1129 | + hp->security_cfm(conn, status, encrypt); |
| 1130 | } |
| 1131 | |
| 1132 | int hci_register_proto(struct hci_proto *hproto); |
| 1133 | @@ -562,8 +584,7 @@ struct hci_cb { |
| 1134 | |
| 1135 | char *name; |
| 1136 | |
| 1137 | - void (*auth_cfm) (struct hci_conn *conn, __u8 status); |
| 1138 | - void (*encrypt_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt); |
| 1139 | + void (*security_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt); |
| 1140 | void (*key_change_cfm) (struct hci_conn *conn, __u8 status); |
| 1141 | void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role); |
| 1142 | }; |
| 1143 | @@ -571,14 +592,20 @@ struct hci_cb { |
| 1144 | static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) |
| 1145 | { |
| 1146 | struct list_head *p; |
| 1147 | + __u8 encrypt; |
| 1148 | |
| 1149 | hci_proto_auth_cfm(conn, status); |
| 1150 | |
| 1151 | + if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) |
| 1152 | + return; |
| 1153 | + |
| 1154 | + encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; |
| 1155 | + |
| 1156 | read_lock_bh(&hci_cb_list_lock); |
| 1157 | list_for_each(p, &hci_cb_list) { |
| 1158 | struct hci_cb *cb = list_entry(p, struct hci_cb, list); |
| 1159 | - if (cb->auth_cfm) |
| 1160 | - cb->auth_cfm(conn, status); |
| 1161 | + if (cb->security_cfm) |
| 1162 | + cb->security_cfm(conn, status, encrypt); |
| 1163 | } |
| 1164 | read_unlock_bh(&hci_cb_list_lock); |
| 1165 | } |
| 1166 | @@ -587,13 +614,16 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encr |
| 1167 | { |
| 1168 | struct list_head *p; |
| 1169 | |
| 1170 | + if (conn->sec_level == BT_SECURITY_SDP) |
| 1171 | + conn->sec_level = BT_SECURITY_LOW; |
| 1172 | + |
| 1173 | hci_proto_encrypt_cfm(conn, status, encrypt); |
| 1174 | |
| 1175 | read_lock_bh(&hci_cb_list_lock); |
| 1176 | list_for_each(p, &hci_cb_list) { |
| 1177 | struct hci_cb *cb = list_entry(p, struct hci_cb, list); |
| 1178 | - if (cb->encrypt_cfm) |
| 1179 | - cb->encrypt_cfm(conn, status, encrypt); |
| 1180 | + if (cb->security_cfm) |
| 1181 | + cb->security_cfm(conn, status, encrypt); |
| 1182 | } |
| 1183 | read_unlock_bh(&hci_cb_list_lock); |
| 1184 | } |
| 1185 | diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h |
| 1186 | index 73e115b..f566aa1 100644 |
| 1187 | --- a/include/net/bluetooth/l2cap.h |
| 1188 | +++ b/include/net/bluetooth/l2cap.h |
| 1189 | @@ -37,6 +37,7 @@ struct sockaddr_l2 { |
| 1190 | sa_family_t l2_family; |
| 1191 | __le16 l2_psm; |
| 1192 | bdaddr_t l2_bdaddr; |
| 1193 | + __le16 l2_cid; |
| 1194 | }; |
| 1195 | |
| 1196 | /* L2CAP socket options */ |
| 1197 | @@ -185,6 +186,7 @@ struct l2cap_info_rsp { |
| 1198 | /* info type */ |
| 1199 | #define L2CAP_IT_CL_MTU 0x0001 |
| 1200 | #define L2CAP_IT_FEAT_MASK 0x0002 |
| 1201 | +#define L2CAP_IT_FIXED_CHAN 0x0003 |
| 1202 | |
| 1203 | /* info result */ |
| 1204 | #define L2CAP_IR_SUCCESS 0x0000 |
| 1205 | @@ -219,11 +221,14 @@ struct l2cap_conn { |
| 1206 | __u8 rx_ident; |
| 1207 | __u8 tx_ident; |
| 1208 | |
| 1209 | + __u8 disc_reason; |
| 1210 | + |
| 1211 | struct l2cap_chan_list chan_list; |
| 1212 | }; |
| 1213 | |
| 1214 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 |
| 1215 | -#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x02 |
| 1216 | +#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 |
| 1217 | +#define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 |
| 1218 | |
| 1219 | /* ----- L2CAP channel and socket info ----- */ |
| 1220 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) |
| 1221 | @@ -237,8 +242,9 @@ struct l2cap_pinfo { |
| 1222 | __u16 imtu; |
| 1223 | __u16 omtu; |
| 1224 | __u16 flush_to; |
| 1225 | - |
| 1226 | - __u32 link_mode; |
| 1227 | + __u8 sec_level; |
| 1228 | + __u8 role_switch; |
| 1229 | + __u8 force_reliable; |
| 1230 | |
| 1231 | __u8 conf_req[64]; |
| 1232 | __u8 conf_len; |
| 1233 | @@ -257,6 +263,7 @@ struct l2cap_pinfo { |
| 1234 | #define L2CAP_CONF_REQ_SENT 0x01 |
| 1235 | #define L2CAP_CONF_INPUT_DONE 0x02 |
| 1236 | #define L2CAP_CONF_OUTPUT_DONE 0x04 |
| 1237 | +#define L2CAP_CONF_CONNECT_PEND 0x80 |
| 1238 | |
| 1239 | #define L2CAP_CONF_MAX_RETRIES 2 |
| 1240 | |
| 1241 | diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h |
| 1242 | index 4dc8d92..8007261 100644 |
| 1243 | --- a/include/net/bluetooth/rfcomm.h |
| 1244 | +++ b/include/net/bluetooth/rfcomm.h |
| 1245 | @@ -183,8 +183,9 @@ struct rfcomm_dlc { |
| 1246 | u8 remote_v24_sig; |
| 1247 | u8 mscex; |
| 1248 | u8 out; |
| 1249 | - |
| 1250 | - u32 link_mode; |
| 1251 | + u8 sec_level; |
| 1252 | + u8 role_switch; |
| 1253 | + u32 defer_setup; |
| 1254 | |
| 1255 | uint mtu; |
| 1256 | uint cfc; |
| 1257 | @@ -202,10 +203,12 @@ struct rfcomm_dlc { |
| 1258 | #define RFCOMM_RX_THROTTLED 0 |
| 1259 | #define RFCOMM_TX_THROTTLED 1 |
| 1260 | #define RFCOMM_TIMED_OUT 2 |
| 1261 | -#define RFCOMM_MSC_PENDING 3 |
| 1262 | -#define RFCOMM_AUTH_PENDING 4 |
| 1263 | -#define RFCOMM_AUTH_ACCEPT 5 |
| 1264 | -#define RFCOMM_AUTH_REJECT 6 |
| 1265 | +#define RFCOMM_MSC_PENDING 3 |
| 1266 | +#define RFCOMM_SEC_PENDING 4 |
| 1267 | +#define RFCOMM_AUTH_PENDING 5 |
| 1268 | +#define RFCOMM_AUTH_ACCEPT 6 |
| 1269 | +#define RFCOMM_AUTH_REJECT 7 |
| 1270 | +#define RFCOMM_DEFER_SETUP 8 |
| 1271 | |
| 1272 | /* Scheduling flags and events */ |
| 1273 | #define RFCOMM_SCHED_STATE 0 |
| 1274 | @@ -239,6 +242,7 @@ int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); |
| 1275 | int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); |
| 1276 | int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); |
| 1277 | int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig); |
| 1278 | +void rfcomm_dlc_accept(struct rfcomm_dlc *d); |
| 1279 | |
| 1280 | #define rfcomm_dlc_lock(d) spin_lock(&d->lock) |
| 1281 | #define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) |
| 1282 | @@ -304,7 +308,8 @@ struct rfcomm_pinfo { |
| 1283 | struct bt_sock bt; |
| 1284 | struct rfcomm_dlc *dlc; |
| 1285 | u8 channel; |
| 1286 | - u32 link_mode; |
| 1287 | + u8 sec_level; |
| 1288 | + u8 role_switch; |
| 1289 | }; |
| 1290 | |
| 1291 | int rfcomm_init_sockets(void); |
| 1292 | @@ -333,7 +338,6 @@ struct rfcomm_dev_req { |
| 1293 | bdaddr_t src; |
| 1294 | bdaddr_t dst; |
| 1295 | u8 channel; |
| 1296 | - |
| 1297 | }; |
| 1298 | |
| 1299 | struct rfcomm_dev_info { |
| 1300 | diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c |
| 1301 | index 744ed3f..02b9baa 100644 |
| 1302 | --- a/net/bluetooth/af_bluetooth.c |
| 1303 | +++ b/net/bluetooth/af_bluetooth.c |
| 1304 | @@ -41,14 +41,13 @@ |
| 1305 | |
| 1306 | #include <net/bluetooth/bluetooth.h> |
| 1307 | |
| 1308 | -#define VERSION "2.14" |
| 1309 | +#define VERSION "2.15" |
| 1310 | |
| 1311 | /* Bluetooth sockets */ |
| 1312 | #define BT_MAX_PROTO 8 |
| 1313 | static struct net_proto_family *bt_proto[BT_MAX_PROTO]; |
| 1314 | static DEFINE_RWLOCK(bt_proto_lock); |
| 1315 | |
| 1316 | -#ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 1317 | static struct lock_class_key bt_lock_key[BT_MAX_PROTO]; |
| 1318 | static const char *bt_key_strings[BT_MAX_PROTO] = { |
| 1319 | "sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP", |
| 1320 | @@ -86,11 +85,6 @@ static inline void bt_sock_reclassify_lock(struct socket *sock, int proto) |
| 1321 | bt_slock_key_strings[proto], &bt_slock_key[proto], |
| 1322 | bt_key_strings[proto], &bt_lock_key[proto]); |
| 1323 | } |
| 1324 | -#else |
| 1325 | -static inline void bt_sock_reclassify_lock(struct socket *sock, int proto) |
| 1326 | -{ |
| 1327 | -} |
| 1328 | -#endif |
| 1329 | |
| 1330 | int bt_sock_register(int proto, struct net_proto_family *ops) |
| 1331 | { |
| 1332 | @@ -217,7 +211,8 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock) |
| 1333 | continue; |
| 1334 | } |
| 1335 | |
| 1336 | - if (sk->sk_state == BT_CONNECTED || !newsock) { |
| 1337 | + if (sk->sk_state == BT_CONNECTED || !newsock || |
| 1338 | + bt_sk(parent)->defer_setup) { |
| 1339 | bt_accept_unlink(sk); |
| 1340 | if (newsock) |
| 1341 | sock_graft(sk, newsock); |
| 1342 | @@ -232,7 +227,7 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock) |
| 1343 | EXPORT_SYMBOL(bt_accept_dequeue); |
| 1344 | |
| 1345 | int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, |
| 1346 | - struct msghdr *msg, size_t len, int flags) |
| 1347 | + struct msghdr *msg, size_t len, int flags) |
| 1348 | { |
| 1349 | int noblock = flags & MSG_DONTWAIT; |
| 1350 | struct sock *sk = sock->sk; |
| 1351 | @@ -277,7 +272,9 @@ static inline unsigned int bt_accept_poll(struct sock *parent) |
| 1352 | |
| 1353 | list_for_each_safe(p, n, &bt_sk(parent)->accept_q) { |
| 1354 | sk = (struct sock *) list_entry(p, struct bt_sock, accept_q); |
| 1355 | - if (sk->sk_state == BT_CONNECTED) |
| 1356 | + if (sk->sk_state == BT_CONNECTED || |
| 1357 | + (bt_sk(parent)->defer_setup && |
| 1358 | + sk->sk_state == BT_CONNECT2)) |
| 1359 | return POLLIN | POLLRDNORM; |
| 1360 | } |
| 1361 | |
| 1362 | diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c |
| 1363 | index c9cac77..0073ec8 100644 |
| 1364 | --- a/net/bluetooth/cmtp/core.c |
| 1365 | +++ b/net/bluetooth/cmtp/core.c |
| 1366 | @@ -126,8 +126,7 @@ static inline void cmtp_add_msgpart(struct cmtp_session *session, int id, const |
| 1367 | |
| 1368 | session->reassembly[id] = nskb; |
| 1369 | |
| 1370 | - if (skb) |
| 1371 | - kfree_skb(skb); |
| 1372 | + kfree_skb(skb); |
| 1373 | } |
| 1374 | |
| 1375 | static inline int cmtp_recv_frame(struct cmtp_session *session, struct sk_buff *skb) |
| 1376 | diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c |
| 1377 | index a4a789f..1181db0 100644 |
| 1378 | --- a/net/bluetooth/hci_conn.c |
| 1379 | +++ b/net/bluetooth/hci_conn.c |
| 1380 | @@ -123,6 +123,8 @@ void hci_add_sco(struct hci_conn *conn, __u16 handle) |
| 1381 | conn->state = BT_CONNECT; |
| 1382 | conn->out = 1; |
| 1383 | |
| 1384 | + conn->attempt++; |
| 1385 | + |
| 1386 | cp.handle = cpu_to_le16(handle); |
| 1387 | cp.pkt_type = cpu_to_le16(conn->pkt_type); |
| 1388 | |
| 1389 | @@ -139,6 +141,8 @@ void hci_setup_sync(struct hci_conn *conn, __u16 handle) |
| 1390 | conn->state = BT_CONNECT; |
| 1391 | conn->out = 1; |
| 1392 | |
| 1393 | + conn->attempt++; |
| 1394 | + |
| 1395 | cp.handle = cpu_to_le16(handle); |
| 1396 | cp.pkt_type = cpu_to_le16(conn->pkt_type); |
| 1397 | |
| 1398 | @@ -155,6 +159,7 @@ static void hci_conn_timeout(unsigned long arg) |
| 1399 | { |
| 1400 | struct hci_conn *conn = (void *) arg; |
| 1401 | struct hci_dev *hdev = conn->hdev; |
| 1402 | + __u8 reason; |
| 1403 | |
| 1404 | BT_DBG("conn %p state %d", conn, conn->state); |
| 1405 | |
| 1406 | @@ -173,7 +178,8 @@ static void hci_conn_timeout(unsigned long arg) |
| 1407 | break; |
| 1408 | case BT_CONFIG: |
| 1409 | case BT_CONNECTED: |
| 1410 | - hci_acl_disconn(conn, 0x13); |
| 1411 | + reason = hci_proto_disconn_ind(conn); |
| 1412 | + hci_acl_disconn(conn, reason); |
| 1413 | break; |
| 1414 | default: |
| 1415 | conn->state = BT_CLOSED; |
| 1416 | @@ -216,12 +222,13 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst) |
| 1417 | break; |
| 1418 | case SCO_LINK: |
| 1419 | if (lmp_esco_capable(hdev)) |
| 1420 | - conn->pkt_type = hdev->esco_type & SCO_ESCO_MASK; |
| 1421 | + conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | |
| 1422 | + (hdev->esco_type & EDR_ESCO_MASK); |
| 1423 | else |
| 1424 | conn->pkt_type = hdev->pkt_type & SCO_PTYPE_MASK; |
| 1425 | break; |
| 1426 | case ESCO_LINK: |
| 1427 | - conn->pkt_type = hdev->esco_type; |
| 1428 | + conn->pkt_type = hdev->esco_type & ~EDR_ESCO_MASK; |
| 1429 | break; |
| 1430 | } |
| 1431 | |
| 1432 | @@ -280,6 +287,8 @@ int hci_conn_del(struct hci_conn *conn) |
| 1433 | |
| 1434 | skb_queue_purge(&conn->data_q); |
| 1435 | |
| 1436 | + hci_conn_del_sysfs(conn); |
| 1437 | + |
| 1438 | return 0; |
| 1439 | } |
| 1440 | |
| 1441 | @@ -325,7 +334,7 @@ EXPORT_SYMBOL(hci_get_route); |
| 1442 | |
| 1443 | /* Create SCO or ACL connection. |
| 1444 | * Device _must_ be locked */ |
| 1445 | -struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 auth_type) |
| 1446 | +struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type) |
| 1447 | { |
| 1448 | struct hci_conn *acl; |
| 1449 | struct hci_conn *sco; |
| 1450 | @@ -340,6 +349,7 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 |
| 1451 | hci_conn_hold(acl); |
| 1452 | |
| 1453 | if (acl->state == BT_OPEN || acl->state == BT_CLOSED) { |
| 1454 | + acl->sec_level = sec_level; |
| 1455 | acl->auth_type = auth_type; |
| 1456 | hci_acl_connect(acl); |
| 1457 | } |
| 1458 | @@ -385,51 +395,59 @@ int hci_conn_check_link_mode(struct hci_conn *conn) |
| 1459 | EXPORT_SYMBOL(hci_conn_check_link_mode); |
| 1460 | |
| 1461 | /* Authenticate remote device */ |
| 1462 | -int hci_conn_auth(struct hci_conn *conn) |
| 1463 | +static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) |
| 1464 | { |
| 1465 | BT_DBG("conn %p", conn); |
| 1466 | |
| 1467 | - if (conn->ssp_mode > 0 && conn->hdev->ssp_mode > 0) { |
| 1468 | - if (!(conn->auth_type & 0x01)) { |
| 1469 | - conn->auth_type |= 0x01; |
| 1470 | - conn->link_mode &= ~HCI_LM_AUTH; |
| 1471 | - } |
| 1472 | - } |
| 1473 | - |
| 1474 | - if (conn->link_mode & HCI_LM_AUTH) |
| 1475 | + if (sec_level > conn->sec_level) |
| 1476 | + conn->sec_level = sec_level; |
| 1477 | + else if (conn->link_mode & HCI_LM_AUTH) |
| 1478 | return 1; |
| 1479 | |
| 1480 | + conn->auth_type = auth_type; |
| 1481 | + |
| 1482 | if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { |
| 1483 | struct hci_cp_auth_requested cp; |
| 1484 | cp.handle = cpu_to_le16(conn->handle); |
| 1485 | hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED, |
| 1486 | sizeof(cp), &cp); |
| 1487 | } |
| 1488 | + |
| 1489 | return 0; |
| 1490 | } |
| 1491 | -EXPORT_SYMBOL(hci_conn_auth); |
| 1492 | |
| 1493 | -/* Enable encryption */ |
| 1494 | -int hci_conn_encrypt(struct hci_conn *conn) |
| 1495 | +/* Enable security */ |
| 1496 | +int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) |
| 1497 | { |
| 1498 | BT_DBG("conn %p", conn); |
| 1499 | |
| 1500 | + if (sec_level == BT_SECURITY_SDP) |
| 1501 | + return 1; |
| 1502 | + |
| 1503 | + if (sec_level == BT_SECURITY_LOW) { |
| 1504 | + if (conn->ssp_mode > 0 && conn->hdev->ssp_mode > 0) |
| 1505 | + return hci_conn_auth(conn, sec_level, auth_type); |
| 1506 | + else |
| 1507 | + return 1; |
| 1508 | + } |
| 1509 | + |
| 1510 | if (conn->link_mode & HCI_LM_ENCRYPT) |
| 1511 | - return hci_conn_auth(conn); |
| 1512 | + return hci_conn_auth(conn, sec_level, auth_type); |
| 1513 | |
| 1514 | if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) |
| 1515 | return 0; |
| 1516 | |
| 1517 | - if (hci_conn_auth(conn)) { |
| 1518 | + if (hci_conn_auth(conn, sec_level, auth_type)) { |
| 1519 | struct hci_cp_set_conn_encrypt cp; |
| 1520 | cp.handle = cpu_to_le16(conn->handle); |
| 1521 | cp.encrypt = 1; |
| 1522 | hci_send_cmd(conn->hdev, HCI_OP_SET_CONN_ENCRYPT, |
| 1523 | sizeof(cp), &cp); |
| 1524 | } |
| 1525 | + |
| 1526 | return 0; |
| 1527 | } |
| 1528 | -EXPORT_SYMBOL(hci_conn_encrypt); |
| 1529 | +EXPORT_SYMBOL(hci_conn_security); |
| 1530 | |
| 1531 | /* Change link key */ |
| 1532 | int hci_conn_change_link_key(struct hci_conn *conn) |
| 1533 | @@ -442,12 +460,13 @@ int hci_conn_change_link_key(struct hci_conn *conn) |
| 1534 | hci_send_cmd(conn->hdev, HCI_OP_CHANGE_CONN_LINK_KEY, |
| 1535 | sizeof(cp), &cp); |
| 1536 | } |
| 1537 | + |
| 1538 | return 0; |
| 1539 | } |
| 1540 | EXPORT_SYMBOL(hci_conn_change_link_key); |
| 1541 | |
| 1542 | /* Switch role */ |
| 1543 | -int hci_conn_switch_role(struct hci_conn *conn, uint8_t role) |
| 1544 | +int hci_conn_switch_role(struct hci_conn *conn, __u8 role) |
| 1545 | { |
| 1546 | BT_DBG("conn %p", conn); |
| 1547 | |
| 1548 | @@ -460,6 +479,7 @@ int hci_conn_switch_role(struct hci_conn *conn, uint8_t role) |
| 1549 | cp.role = role; |
| 1550 | hci_send_cmd(conn->hdev, HCI_OP_SWITCH_ROLE, sizeof(cp), &cp); |
| 1551 | } |
| 1552 | + |
| 1553 | return 0; |
| 1554 | } |
| 1555 | EXPORT_SYMBOL(hci_conn_switch_role); |
| 1556 | @@ -542,9 +562,7 @@ void hci_conn_hash_flush(struct hci_dev *hdev) |
| 1557 | |
| 1558 | c->state = BT_CLOSED; |
| 1559 | |
| 1560 | - hci_conn_del_sysfs(c); |
| 1561 | - |
| 1562 | - hci_proto_disconn_ind(c, 0x16); |
| 1563 | + hci_proto_disconn_cfm(c, 0x16); |
| 1564 | hci_conn_del(c); |
| 1565 | } |
| 1566 | } |
| 1567 | diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
| 1568 | index ba78cc1..cd06151 100644 |
| 1569 | --- a/net/bluetooth/hci_core.c |
| 1570 | +++ b/net/bluetooth/hci_core.c |
| 1571 | @@ -1565,8 +1565,7 @@ static void hci_cmd_task(unsigned long arg) |
| 1572 | |
| 1573 | /* Send queued commands */ |
| 1574 | if (atomic_read(&hdev->cmd_cnt) && (skb = skb_dequeue(&hdev->cmd_q))) { |
| 1575 | - if (hdev->sent_cmd) |
| 1576 | - kfree_skb(hdev->sent_cmd); |
| 1577 | + kfree_skb(hdev->sent_cmd); |
| 1578 | |
| 1579 | if ((hdev->sent_cmd = skb_clone(skb, GFP_ATOMIC))) { |
| 1580 | atomic_dec(&hdev->cmd_cnt); |
| 1581 | diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
| 1582 | index f91ba69..5553424 100644 |
| 1583 | --- a/net/bluetooth/hci_event.c |
| 1584 | +++ b/net/bluetooth/hci_event.c |
| 1585 | @@ -484,6 +484,15 @@ static void hci_cc_read_local_features(struct hci_dev *hdev, struct sk_buff *skb |
| 1586 | if (hdev->features[4] & LMP_EV5) |
| 1587 | hdev->esco_type |= (ESCO_EV5); |
| 1588 | |
| 1589 | + if (hdev->features[5] & LMP_EDR_ESCO_2M) |
| 1590 | + hdev->esco_type |= (ESCO_2EV3); |
| 1591 | + |
| 1592 | + if (hdev->features[5] & LMP_EDR_ESCO_3M) |
| 1593 | + hdev->esco_type |= (ESCO_3EV3); |
| 1594 | + |
| 1595 | + if (hdev->features[5] & LMP_EDR_3S_ESCO) |
| 1596 | + hdev->esco_type |= (ESCO_2EV5 | ESCO_3EV5); |
| 1597 | + |
| 1598 | BT_DBG("%s features 0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x", hdev->name, |
| 1599 | hdev->features[0], hdev->features[1], |
| 1600 | hdev->features[2], hdev->features[3], |
| 1601 | @@ -914,7 +923,8 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s |
| 1602 | if (ev->status) { |
| 1603 | hci_proto_connect_cfm(conn, ev->status); |
| 1604 | hci_conn_del(conn); |
| 1605 | - } |
| 1606 | + } else if (ev->link_type != ACL_LINK) |
| 1607 | + hci_proto_connect_cfm(conn, ev->status); |
| 1608 | |
| 1609 | unlock: |
| 1610 | hci_dev_unlock(hdev); |
| 1611 | @@ -1009,9 +1019,7 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff |
| 1612 | if (conn) { |
| 1613 | conn->state = BT_CLOSED; |
| 1614 | |
| 1615 | - hci_conn_del_sysfs(conn); |
| 1616 | - |
| 1617 | - hci_proto_disconn_ind(conn, ev->reason); |
| 1618 | + hci_proto_disconn_cfm(conn, ev->reason); |
| 1619 | hci_conn_del(conn); |
| 1620 | } |
| 1621 | |
| 1622 | @@ -1600,7 +1608,8 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b |
| 1623 | |
| 1624 | if (conn->state == BT_CONFIG) { |
| 1625 | if (!ev->status && hdev->ssp_mode > 0 && |
| 1626 | - conn->ssp_mode > 0 && conn->out) { |
| 1627 | + conn->ssp_mode > 0 && conn->out && |
| 1628 | + conn->sec_level != BT_SECURITY_SDP) { |
| 1629 | struct hci_cp_auth_requested cp; |
| 1630 | cp.handle = ev->handle; |
| 1631 | hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, |
| 1632 | @@ -1637,6 +1646,13 @@ static inline void hci_sync_conn_complete_evt(struct hci_dev *hdev, struct sk_bu |
| 1633 | conn->type = SCO_LINK; |
| 1634 | } |
| 1635 | |
| 1636 | + if (conn->out && ev->status == 0x1c && conn->attempt < 2) { |
| 1637 | + conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | |
| 1638 | + (hdev->esco_type & EDR_ESCO_MASK); |
| 1639 | + hci_setup_sync(conn, conn->link->handle); |
| 1640 | + goto unlock; |
| 1641 | + } |
| 1642 | + |
| 1643 | if (!ev->status) { |
| 1644 | conn->handle = __le16_to_cpu(ev->handle); |
| 1645 | conn->state = BT_CONNECTED; |
| 1646 | diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c |
| 1647 | index b93748e..ca4d3b4 100644 |
| 1648 | --- a/net/bluetooth/l2cap.c |
| 1649 | +++ b/net/bluetooth/l2cap.c |
| 1650 | @@ -50,9 +50,10 @@ |
| 1651 | #include <net/bluetooth/hci_core.h> |
| 1652 | #include <net/bluetooth/l2cap.h> |
| 1653 | |
| 1654 | -#define VERSION "2.11" |
| 1655 | +#define VERSION "2.13" |
| 1656 | |
| 1657 | -static u32 l2cap_feat_mask = 0x0000; |
| 1658 | +static u32 l2cap_feat_mask = 0x0080; |
| 1659 | +static u8 l2cap_fixed_chan[8] = { 0x02, }; |
| 1660 | |
| 1661 | static const struct proto_ops l2cap_sock_ops; |
| 1662 | |
| 1663 | @@ -77,9 +78,10 @@ static void l2cap_sock_timeout(unsigned long arg) |
| 1664 | |
| 1665 | bh_lock_sock(sk); |
| 1666 | |
| 1667 | - if (sk->sk_state == BT_CONNECT && |
| 1668 | - (l2cap_pi(sk)->link_mode & (L2CAP_LM_AUTH | |
| 1669 | - L2CAP_LM_ENCRYPT | L2CAP_LM_SECURE))) |
| 1670 | + if (sk->sk_state == BT_CONNECTED || sk->sk_state == BT_CONFIG) |
| 1671 | + reason = ECONNREFUSED; |
| 1672 | + else if (sk->sk_state == BT_CONNECT && |
| 1673 | + l2cap_pi(sk)->sec_level != BT_SECURITY_SDP) |
| 1674 | reason = ECONNREFUSED; |
| 1675 | else |
| 1676 | reason = ETIMEDOUT; |
| 1677 | @@ -204,6 +206,8 @@ static void __l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, struct so |
| 1678 | |
| 1679 | BT_DBG("conn %p, psm 0x%2.2x, dcid 0x%4.4x", conn, l2cap_pi(sk)->psm, l2cap_pi(sk)->dcid); |
| 1680 | |
| 1681 | + conn->disc_reason = 0x13; |
| 1682 | + |
| 1683 | l2cap_pi(sk)->conn = conn; |
| 1684 | |
| 1685 | if (sk->sk_type == SOCK_SEQPACKET) { |
| 1686 | @@ -259,18 +263,35 @@ static void l2cap_chan_del(struct sock *sk, int err) |
| 1687 | } |
| 1688 | |
| 1689 | /* Service level security */ |
| 1690 | -static inline int l2cap_check_link_mode(struct sock *sk) |
| 1691 | +static inline int l2cap_check_security(struct sock *sk) |
| 1692 | { |
| 1693 | struct l2cap_conn *conn = l2cap_pi(sk)->conn; |
| 1694 | + __u8 auth_type; |
| 1695 | |
| 1696 | - if ((l2cap_pi(sk)->link_mode & L2CAP_LM_ENCRYPT) || |
| 1697 | - (l2cap_pi(sk)->link_mode & L2CAP_LM_SECURE)) |
| 1698 | - return hci_conn_encrypt(conn->hcon); |
| 1699 | + if (l2cap_pi(sk)->psm == cpu_to_le16(0x0001)) { |
| 1700 | + if (l2cap_pi(sk)->sec_level == BT_SECURITY_HIGH) |
| 1701 | + auth_type = HCI_AT_NO_BONDING_MITM; |
| 1702 | + else |
| 1703 | + auth_type = HCI_AT_NO_BONDING; |
| 1704 | |
| 1705 | - if (l2cap_pi(sk)->link_mode & L2CAP_LM_AUTH) |
| 1706 | - return hci_conn_auth(conn->hcon); |
| 1707 | + if (l2cap_pi(sk)->sec_level == BT_SECURITY_LOW) |
| 1708 | + l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; |
| 1709 | + } else { |
| 1710 | + switch (l2cap_pi(sk)->sec_level) { |
| 1711 | + case BT_SECURITY_HIGH: |
| 1712 | + auth_type = HCI_AT_GENERAL_BONDING_MITM; |
| 1713 | + break; |
| 1714 | + case BT_SECURITY_MEDIUM: |
| 1715 | + auth_type = HCI_AT_GENERAL_BONDING; |
| 1716 | + break; |
| 1717 | + default: |
| 1718 | + auth_type = HCI_AT_NO_BONDING; |
| 1719 | + break; |
| 1720 | + } |
| 1721 | + } |
| 1722 | |
| 1723 | - return 1; |
| 1724 | + return hci_conn_security(conn->hcon, l2cap_pi(sk)->sec_level, |
| 1725 | + auth_type); |
| 1726 | } |
| 1727 | |
| 1728 | static inline u8 l2cap_get_ident(struct l2cap_conn *conn) |
| 1729 | @@ -312,7 +333,10 @@ static void l2cap_do_start(struct sock *sk) |
| 1730 | struct l2cap_conn *conn = l2cap_pi(sk)->conn; |
| 1731 | |
| 1732 | if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT) { |
| 1733 | - if (l2cap_check_link_mode(sk)) { |
| 1734 | + if (!(conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_DONE)) |
| 1735 | + return; |
| 1736 | + |
| 1737 | + if (l2cap_check_security(sk)) { |
| 1738 | struct l2cap_conn_req req; |
| 1739 | req.scid = cpu_to_le16(l2cap_pi(sk)->scid); |
| 1740 | req.psm = l2cap_pi(sk)->psm; |
| 1741 | @@ -356,7 +380,7 @@ static void l2cap_conn_start(struct l2cap_conn *conn) |
| 1742 | } |
| 1743 | |
| 1744 | if (sk->sk_state == BT_CONNECT) { |
| 1745 | - if (l2cap_check_link_mode(sk)) { |
| 1746 | + if (l2cap_check_security(sk)) { |
| 1747 | struct l2cap_conn_req req; |
| 1748 | req.scid = cpu_to_le16(l2cap_pi(sk)->scid); |
| 1749 | req.psm = l2cap_pi(sk)->psm; |
| 1750 | @@ -371,10 +395,18 @@ static void l2cap_conn_start(struct l2cap_conn *conn) |
| 1751 | rsp.scid = cpu_to_le16(l2cap_pi(sk)->dcid); |
| 1752 | rsp.dcid = cpu_to_le16(l2cap_pi(sk)->scid); |
| 1753 | |
| 1754 | - if (l2cap_check_link_mode(sk)) { |
| 1755 | - sk->sk_state = BT_CONFIG; |
| 1756 | - rsp.result = cpu_to_le16(L2CAP_CR_SUCCESS); |
| 1757 | - rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO); |
| 1758 | + if (l2cap_check_security(sk)) { |
| 1759 | + if (bt_sk(sk)->defer_setup) { |
| 1760 | + struct sock *parent = bt_sk(sk)->parent; |
| 1761 | + rsp.result = cpu_to_le16(L2CAP_CR_PEND); |
| 1762 | + rsp.status = cpu_to_le16(L2CAP_CS_AUTHOR_PEND); |
| 1763 | + parent->sk_data_ready(parent, 0); |
| 1764 | + |
| 1765 | + } else { |
| 1766 | + sk->sk_state = BT_CONFIG; |
| 1767 | + rsp.result = cpu_to_le16(L2CAP_CR_SUCCESS); |
| 1768 | + rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO); |
| 1769 | + } |
| 1770 | } else { |
| 1771 | rsp.result = cpu_to_le16(L2CAP_CR_PEND); |
| 1772 | rsp.status = cpu_to_le16(L2CAP_CS_AUTHEN_PEND); |
| 1773 | @@ -426,7 +458,7 @@ static void l2cap_conn_unreliable(struct l2cap_conn *conn, int err) |
| 1774 | read_lock(&l->lock); |
| 1775 | |
| 1776 | for (sk = l->head; sk; sk = l2cap_pi(sk)->next_c) { |
| 1777 | - if (l2cap_pi(sk)->link_mode & L2CAP_LM_RELIABLE) |
| 1778 | + if (l2cap_pi(sk)->force_reliable) |
| 1779 | sk->sk_err = err; |
| 1780 | } |
| 1781 | |
| 1782 | @@ -437,6 +469,7 @@ static void l2cap_info_timeout(unsigned long arg) |
| 1783 | { |
| 1784 | struct l2cap_conn *conn = (void *) arg; |
| 1785 | |
| 1786 | + conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE; |
| 1787 | conn->info_ident = 0; |
| 1788 | |
| 1789 | l2cap_conn_start(conn); |
| 1790 | @@ -470,6 +503,8 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status) |
| 1791 | spin_lock_init(&conn->lock); |
| 1792 | rwlock_init(&conn->chan_list.lock); |
| 1793 | |
| 1794 | + conn->disc_reason = 0x13; |
| 1795 | + |
| 1796 | return conn; |
| 1797 | } |
| 1798 | |
| 1799 | @@ -483,8 +518,7 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err) |
| 1800 | |
| 1801 | BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); |
| 1802 | |
| 1803 | - if (conn->rx_skb) |
| 1804 | - kfree_skb(conn->rx_skb); |
| 1805 | + kfree_skb(conn->rx_skb); |
| 1806 | |
| 1807 | /* Kill channels */ |
| 1808 | while ((sk = conn->chan_list.head)) { |
| 1809 | @@ -608,7 +642,6 @@ static void __l2cap_sock_close(struct sock *sk, int reason) |
| 1810 | |
| 1811 | case BT_CONNECTED: |
| 1812 | case BT_CONFIG: |
| 1813 | - case BT_CONNECT2: |
| 1814 | if (sk->sk_type == SOCK_SEQPACKET) { |
| 1815 | struct l2cap_conn *conn = l2cap_pi(sk)->conn; |
| 1816 | struct l2cap_disconn_req req; |
| 1817 | @@ -624,6 +657,27 @@ static void __l2cap_sock_close(struct sock *sk, int reason) |
| 1818 | l2cap_chan_del(sk, reason); |
| 1819 | break; |
| 1820 | |
| 1821 | + case BT_CONNECT2: |
| 1822 | + if (sk->sk_type == SOCK_SEQPACKET) { |
| 1823 | + struct l2cap_conn *conn = l2cap_pi(sk)->conn; |
| 1824 | + struct l2cap_conn_rsp rsp; |
| 1825 | + __u16 result; |
| 1826 | + |
| 1827 | + if (bt_sk(sk)->defer_setup) |
| 1828 | + result = L2CAP_CR_SEC_BLOCK; |
| 1829 | + else |
| 1830 | + result = L2CAP_CR_BAD_PSM; |
| 1831 | + |
| 1832 | + rsp.scid = cpu_to_le16(l2cap_pi(sk)->dcid); |
| 1833 | + rsp.dcid = cpu_to_le16(l2cap_pi(sk)->scid); |
| 1834 | + rsp.result = cpu_to_le16(result); |
| 1835 | + rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO); |
| 1836 | + l2cap_send_cmd(conn, l2cap_pi(sk)->ident, |
| 1837 | + L2CAP_CONN_RSP, sizeof(rsp), &rsp); |
| 1838 | + } else |
| 1839 | + l2cap_chan_del(sk, reason); |
| 1840 | + break; |
| 1841 | + |
| 1842 | case BT_CONNECT: |
| 1843 | case BT_DISCONN: |
| 1844 | l2cap_chan_del(sk, reason); |
| 1845 | @@ -653,13 +707,19 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent) |
| 1846 | |
| 1847 | if (parent) { |
| 1848 | sk->sk_type = parent->sk_type; |
| 1849 | + bt_sk(sk)->defer_setup = bt_sk(parent)->defer_setup; |
| 1850 | + |
| 1851 | pi->imtu = l2cap_pi(parent)->imtu; |
| 1852 | pi->omtu = l2cap_pi(parent)->omtu; |
| 1853 | - pi->link_mode = l2cap_pi(parent)->link_mode; |
| 1854 | + pi->sec_level = l2cap_pi(parent)->sec_level; |
| 1855 | + pi->role_switch = l2cap_pi(parent)->role_switch; |
| 1856 | + pi->force_reliable = l2cap_pi(parent)->force_reliable; |
| 1857 | } else { |
| 1858 | pi->imtu = L2CAP_DEFAULT_MTU; |
| 1859 | pi->omtu = 0; |
| 1860 | - pi->link_mode = 0; |
| 1861 | + pi->sec_level = BT_SECURITY_LOW; |
| 1862 | + pi->role_switch = 0; |
| 1863 | + pi->force_reliable = 0; |
| 1864 | } |
| 1865 | |
| 1866 | /* Default config options */ |
| 1867 | @@ -723,17 +783,24 @@ static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol) |
| 1868 | return 0; |
| 1869 | } |
| 1870 | |
| 1871 | -static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) |
| 1872 | +static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) |
| 1873 | { |
| 1874 | - struct sockaddr_l2 *la = (struct sockaddr_l2 *) addr; |
| 1875 | struct sock *sk = sock->sk; |
| 1876 | - int err = 0; |
| 1877 | + struct sockaddr_l2 la; |
| 1878 | + int len, err = 0; |
| 1879 | |
| 1880 | - BT_DBG("sk %p, %s %d", sk, batostr(&la->l2_bdaddr), la->l2_psm); |
| 1881 | + BT_DBG("sk %p", sk); |
| 1882 | |
| 1883 | if (!addr || addr->sa_family != AF_BLUETOOTH) |
| 1884 | return -EINVAL; |
| 1885 | |
| 1886 | + memset(&la, 0, sizeof(la)); |
| 1887 | + len = min_t(unsigned int, sizeof(la), alen); |
| 1888 | + memcpy(&la, addr, len); |
| 1889 | + |
| 1890 | + if (la.l2_cid) |
| 1891 | + return -EINVAL; |
| 1892 | + |
| 1893 | lock_sock(sk); |
| 1894 | |
| 1895 | if (sk->sk_state != BT_OPEN) { |
| 1896 | @@ -741,7 +808,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_ |
| 1897 | goto done; |
| 1898 | } |
| 1899 | |
| 1900 | - if (la->l2_psm && btohs(la->l2_psm) < 0x1001 && |
| 1901 | + if (la.l2_psm && btohs(la.l2_psm) < 0x1001 && |
| 1902 | !capable(CAP_NET_BIND_SERVICE)) { |
| 1903 | err = -EACCES; |
| 1904 | goto done; |
| 1905 | @@ -749,14 +816,17 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_ |
| 1906 | |
| 1907 | write_lock_bh(&l2cap_sk_list.lock); |
| 1908 | |
| 1909 | - if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) { |
| 1910 | + if (la.l2_psm && __l2cap_get_sock_by_addr(la.l2_psm, &la.l2_bdaddr)) { |
| 1911 | err = -EADDRINUSE; |
| 1912 | } else { |
| 1913 | /* Save source address */ |
| 1914 | - bacpy(&bt_sk(sk)->src, &la->l2_bdaddr); |
| 1915 | - l2cap_pi(sk)->psm = la->l2_psm; |
| 1916 | - l2cap_pi(sk)->sport = la->l2_psm; |
| 1917 | + bacpy(&bt_sk(sk)->src, &la.l2_bdaddr); |
| 1918 | + l2cap_pi(sk)->psm = la.l2_psm; |
| 1919 | + l2cap_pi(sk)->sport = la.l2_psm; |
| 1920 | sk->sk_state = BT_BOUND; |
| 1921 | + |
| 1922 | + if (btohs(la.l2_psm) == 0x0001 || btohs(la.l2_psm) == 0x0003) |
| 1923 | + l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; |
| 1924 | } |
| 1925 | |
| 1926 | write_unlock_bh(&l2cap_sk_list.lock); |
| 1927 | @@ -776,7 +846,8 @@ static int l2cap_do_connect(struct sock *sk) |
| 1928 | __u8 auth_type; |
| 1929 | int err = 0; |
| 1930 | |
| 1931 | - BT_DBG("%s -> %s psm 0x%2.2x", batostr(src), batostr(dst), l2cap_pi(sk)->psm); |
| 1932 | + BT_DBG("%s -> %s psm 0x%2.2x", batostr(src), batostr(dst), |
| 1933 | + l2cap_pi(sk)->psm); |
| 1934 | |
| 1935 | if (!(hdev = hci_get_route(dst, src))) |
| 1936 | return -EHOSTUNREACH; |
| 1937 | @@ -785,21 +856,42 @@ static int l2cap_do_connect(struct sock *sk) |
| 1938 | |
| 1939 | err = -ENOMEM; |
| 1940 | |
| 1941 | - if (l2cap_pi(sk)->link_mode & L2CAP_LM_AUTH || |
| 1942 | - l2cap_pi(sk)->link_mode & L2CAP_LM_ENCRYPT || |
| 1943 | - l2cap_pi(sk)->link_mode & L2CAP_LM_SECURE) { |
| 1944 | - if (l2cap_pi(sk)->psm == cpu_to_le16(0x0001)) |
| 1945 | + if (sk->sk_type == SOCK_RAW) { |
| 1946 | + switch (l2cap_pi(sk)->sec_level) { |
| 1947 | + case BT_SECURITY_HIGH: |
| 1948 | + auth_type = HCI_AT_DEDICATED_BONDING_MITM; |
| 1949 | + break; |
| 1950 | + case BT_SECURITY_MEDIUM: |
| 1951 | + auth_type = HCI_AT_DEDICATED_BONDING; |
| 1952 | + break; |
| 1953 | + default: |
| 1954 | + auth_type = HCI_AT_NO_BONDING; |
| 1955 | + break; |
| 1956 | + } |
| 1957 | + } else if (l2cap_pi(sk)->psm == cpu_to_le16(0x0001)) { |
| 1958 | + if (l2cap_pi(sk)->sec_level == BT_SECURITY_HIGH) |
| 1959 | auth_type = HCI_AT_NO_BONDING_MITM; |
| 1960 | else |
| 1961 | - auth_type = HCI_AT_GENERAL_BONDING_MITM; |
| 1962 | - } else { |
| 1963 | - if (l2cap_pi(sk)->psm == cpu_to_le16(0x0001)) |
| 1964 | auth_type = HCI_AT_NO_BONDING; |
| 1965 | - else |
| 1966 | + |
| 1967 | + if (l2cap_pi(sk)->sec_level == BT_SECURITY_LOW) |
| 1968 | + l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; |
| 1969 | + } else { |
| 1970 | + switch (l2cap_pi(sk)->sec_level) { |
| 1971 | + case BT_SECURITY_HIGH: |
| 1972 | + auth_type = HCI_AT_GENERAL_BONDING_MITM; |
| 1973 | + break; |
| 1974 | + case BT_SECURITY_MEDIUM: |
| 1975 | auth_type = HCI_AT_GENERAL_BONDING; |