1. 23 6月, 2013 5 次提交
  2. 14 6月, 2013 23 次提交
    • S
      NFC: llcp: Fix the well known services endianness · 4ca546e5
      Samuel Ortiz 提交于
      The WKS (Well Known Services) bitmask should be transmitted in big endian
      order. Picky implementations will refuse to establish an LLCP link when the
      WKS bit 0 is not set to 1. The vast majority of implementations out there
      are not that picky though...
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      4ca546e5
    • S
      NFC: llcp: Set the LLC Link Management well known service bit · f768b340
      Samuel Ortiz 提交于
      In order to advertise our LLCP support properly and to follow the LLCP
      specs requirements, we need to initialize the WKS (Well-Known Services)
      bitfield to 1 as SAP 0 is the only mandatory supported service.
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      f768b340
    • S
      NFC: llcp: Do not send pending Tx frames when the remote is not ready · 2635a4bd
      Samuel Ortiz 提交于
      When we receive a RNR, the remote is busy processing the last received
      frame. We set a local flag for that, and we should send a SYMM when it
      is set instead of sending any pending frame.
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      2635a4bd
    • S
      NFC: llcp: Fix non blocking sockets connections · b4011239
      Samuel Ortiz 提交于
      Without the new LLCP_CONNECTING state, non blocking sockets will be
      woken up with a POLLHUP right after calling connect() because their
      state is stuck at LLCP_CLOSED.
      That prevents userspace from implementing any proper non blocking
      socket based NFC p2p client.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      b4011239
    • T
      NFC: Fix a potential memory leak · f1b79dc8
      Thierry Escande 提交于
      In nfc_llcp_tx_work() the sk_buff is not freed when the llcp_sock
      is null and the PDU is an I one.
      Signed-off-by: NThierry Escande <thierry.escande@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      f1b79dc8
    • T
      NFC: Keep socket alive until the DISC PDU is actually sent · 17f7ae16
      Thierry Escande 提交于
      This patch keeps the socket alive and therefore does not remove
      it from the sockets list in the local until the DISC PDU has been
      actually sent. Otherwise we would reply with DM PDUs before sending
      the DISC one.
      Signed-off-by: NThierry Escande <thierry.escande@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      17f7ae16
    • T
      NFC: Rename nfc_llcp_disconnect() to nfc_llcp_send_disconnect() · 58e3dd15
      Thierry Escande 提交于
      nfc_llcp_send_disconnect() already exists but is not used.
      nfc_llcp_disconnect() naming is not consistent with other PDU
      sending functions.
      This patch removes nfc_llcp_send_disconnect() and renames
      nfc_llcp_disconnect()
      Signed-off-by: NThierry Escande <thierry.escande@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      58e3dd15
    • S
      NFC: Add secure element enablement netlink API · be085653
      Samuel Ortiz 提交于
      Enabling or disabling an NFC accessible secure element through netlink
      requires giving both an NFC controller and a secure element indexes.
      Once enabled the secure element will handle card emulation once polling
      starts.
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      be085653
    • S
      NFC: Add secure element enablement internal API · c531c9ec
      Samuel Ortiz 提交于
      Called via netlink, this API will enable or disable a specific secure
      element. When a secure element is enabled, it will handle card emulation
      and more generically ISO-DEP target mode, i.e. all target mode cases
      except for p2p target mode.
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      c531c9ec
    • S
      ee656e9d
    • S
      NFC: Send netlink events for secure elements additions and removals · 2757c372
      Samuel Ortiz 提交于
      When an NFC driver or host controller stack discovers a secure element,
      it will call nfc_add_se(). In order for userspace applications to use
      these secure elements, a netlink event will then be sent with the SE
      index and its type. With that information userspace applications can
      decide wether or not to enable SEs, through their indexes.
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      2757c372
    • S
      NFC: Add secure elements addition and removal API · fed7c25e
      Samuel Ortiz 提交于
      This API will allow NFC drivers to add and remove the secure elements
      they know about or detect. Typically this should be called (asynchronously
      or not) from the driver or the host interface stack detect_se hook.
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      fed7c25e
    • S
      NFC: Extend and fix the internal secure element API · 0a946301
      Samuel Ortiz 提交于
      Secure elements need to be discovered after enabling the NFC controller.
      This is typically done by the NCI core and the HCI drivers (HCI does not
      specify how to discover SEs, it is left to the specific drivers).
      Also, the SE enable/disable API explicitely takes a SE index as its
      argument.
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      0a946301
    • S
      NFC: Remove the static supported_se field · 0b456c41
      Samuel Ortiz 提交于
      Supported secure elements are typically found during a discovery process
      initiated when the NFC controller is up and running. For a given NFC
      chipset there can be many configurations (embedded SE or not, with or
      without a SIM card wired to the NFC controller SWP interface, etc...) and
      thus driver code will never know before hand which SEs are available.
      So we remove this field, it will be replaced by a real SE discovery
      mechanism.
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      0b456c41
    • F
      NFC: Add NCI over SPI receive · 391d8a2d
      Frederic Danis 提交于
      Before any operation, driver interruption is de-asserted to prevent
      race condition between TX and RX.
      
      Transaction starts by emitting "Direct read" and acknowledged mode
      bytes. Then packet length is read allowing to allocate correct NCI
      socket buffer. After that payload is retrieved.
      
      A delay after the transaction can be added.
      This delay is determined by the driver during nci_spi_allocate_device()
      call and can be 0.
      
      If acknowledged mode is set:
      - CRC of header and payload is checked
      - if frame reception fails (CRC error): NACK is sent
      - if received frame has ACK or NACK flag: unblock nci_spi_send()
      
      Payload is passed to NCI module.
      
      At the end, driver interruption is re asserted.
      Signed-off-by: NFrederic Danis <frederic.danis@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      391d8a2d
    • F
      NFC: Add NCI over SPI send · ee9596d4
      Frederic Danis 提交于
      Before any operation, driver interruption is de-asserted to prevent
      race condition between TX and RX.
      
      The NCI over SPI header is added in front of NCI packet.
      If acknowledged mode is set, CRC-16-CCITT is added to the packet.
      Then the packet is forwarded to SPI module to be sent.
      
      A delay after the transaction is added.
      This delay is determined by the driver during nci_spi_allocate_device()
      call and can be 0.
      
      After data has been sent, driver interruption is re-asserted.
      
      If acknowledged mode is set, nci_spi_send will block until
      acknowledgment is received.
      Signed-off-by: NFrederic Danis <frederic.danis@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      ee9596d4
    • F
      NFC: Add basic NCI over SPI · 8a00a61b
      Frederic Danis 提交于
      The NFC Forum defines a transport interface based on
      Serial Peripheral Interface (SPI) for the NFC Controller
      Interface (NCI).
      
      This module implements the SPI transport of NCI, calling SPI module
      directly to read/write data to NFC controller (NFCC).
      
      NFCC driver should provide functions performing device open and close.
      It should also provide functions asserting/de-asserting interruption
      to prevent TX/RX race conditions.
      NFCC driver can also fix a delay between transactions if needed by
      the hardware.
      Signed-off-by: NFrederic Danis <frederic.danis@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      8a00a61b
    • S
      NFC: HCI: Follow a positive code path in the HCI ops implementations · a395298c
      Samuel Ortiz 提交于
      Exiting on the error case is more typical to the kernel coding style.
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      a395298c
    • E
      NFC: HCI: Implement fw_upload ops · 9a695d23
      Eric Lapuyade 提交于
      This is a simple forward to the HCI driver. When driver is done with the
      operation, it shall directly notify NFC Core by calling
      nfc_fw_upload_done().
      Signed-off-by: NEric Lapuyade <eric.lapuyade@intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      9a695d23
    • E
      NFC: Add firmware upload netlink command · 9674da87
      Eric Lapuyade 提交于
      As several NFC chipsets can have their firmwares upgraded and
      reflashed, this patchset adds a new netlink command to trigger
      that the driver loads or flashes a new firmware. This will allows
      userspace triggered firmware upgrade through netlink.
      The firmware name or hint is passed as a parameter, and the driver
      will eventually fetch the firmware binary through the request_firmware
      API.
      The cmd can only be executed when the nfc dev is not in use. Actual
      firmware loading/flashing is an asynchronous operation. Result of the
      operation shall send a new event up to user space through the nfc dev
      multicast socket. During operation, the nfc dev is not openable and
      thus not usable.
      Signed-off-by: NEric Lapuyade <eric.lapuyade@intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      9674da87
    • F
      NFC: NCI: Fix skb->dev usage · 1095e69f
      Frederic Danis 提交于
      skb->dev is used for carrying a net_device pointer and not
      an nci_dev pointer.
      
      Remove usage of skb-dev to carry nci_dev and replace it by parameter
      in nci_recv_frame(), nci_send_frame() and driver send() functions.
      
      NfcWilink driver is also updated to use those functions.
      Signed-off-by: NFrederic Danis <frederic.danis@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      1095e69f
    • J
      Bluetooth: Fix conditions for HCI_Delete_Stored_Link_Key · 59f45d57
      Johan Hedberg 提交于
      Even though the HCI_Delete_Stored_Link_Key command is mandatory for 1.1
      and later controllers some controllers do not seem to support it
      properly as was witnessed by one Broadcom based controller:
      
      < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7
          bdaddr 00:00:00:00:00:00 all 1
      > HCI Event: Command Complete (0x0e) plen 4
          Delete Stored Link Key (0x03|0x0012) ncmd 1
          status 0x11 deleted 0
          Error: Unsupported Feature or Parameter Value
      
      Luckily this same controller also doesn't list the command in its
      supported commands bit mask (counting from 0 bit 7 of octet 6):
      
      < HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0
      > HCI Event: Command Complete (0x0e) plen 68
          Read Local Supported Commands (0x04|0x0002) ncmd 1
          status 0x00
          Commands: ffffffffffff1ffffffffffff30fffff3f
      
      Therefore, it makes sense to move sending of HCI_Delete_Stored_Link_Key
      to after receiving the supported commands response and to only send it
      if its respective bit in the mask is set. The downside of this is that
      we no longer send the HCI_Delete_Stored_Link_Key command for Bluetooth
      1.1 controllers since HCI_Read_Local_Supported_Command was introduced in
      version 1.2, but this is an acceptable penalty as the command in
      question shouldn't affect critical behavior.
      Reported-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      Tested-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      59f45d57
    • A
      Bluetooth: Fix crash in l2cap_build_cmd() with small MTU · 300b962e
      Anderson Lizardo 提交于
      If a too small MTU value is set with ioctl(HCISETACLMTU) or by a bogus
      controller, memory corruption happens due to a memcpy() call with
      negative length.
      
      Fix this crash on either incoming or outgoing connections with a MTU
      smaller than L2CAP_HDR_SIZE + L2CAP_CMD_HDR_SIZE:
      
      [   46.885433] BUG: unable to handle kernel paging request at f56ad000
      [   46.888037] IP: [<c03d94cd>] memcpy+0x1d/0x40
      [   46.888037] *pdpt = 0000000000ac3001 *pde = 00000000373f8067 *pte = 80000000356ad060
      [   46.888037] Oops: 0002 [#1] SMP DEBUG_PAGEALLOC
      [   46.888037] Modules linked in: hci_vhci bluetooth virtio_balloon i2c_piix4 uhci_hcd usbcore usb_common
      [   46.888037] CPU: 0 PID: 1044 Comm: kworker/u3:0 Not tainted 3.10.0-rc1+ #12
      [   46.888037] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
      [   46.888037] Workqueue: hci0 hci_rx_work [bluetooth]
      [   46.888037] task: f59b15b0 ti: f55c4000 task.ti: f55c4000
      [   46.888037] EIP: 0060:[<c03d94cd>] EFLAGS: 00010212 CPU: 0
      [   46.888037] EIP is at memcpy+0x1d/0x40
      [   46.888037] EAX: f56ac1c0 EBX: fffffff8 ECX: 3ffffc6e EDX: f55c5cf2
      [   46.888037] ESI: f55c6b32 EDI: f56ad000 EBP: f55c5c68 ESP: f55c5c5c
      [   46.888037]  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
      [   46.888037] CR0: 8005003b CR2: f56ad000 CR3: 3557d000 CR4: 000006f0
      [   46.888037] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
      [   46.888037] DR6: ffff0ff0 DR7: 00000400
      [   46.888037] Stack:
      [   46.888037]  fffffff8 00000010 00000003 f55c5cac f8c6a54c ffffffff f8c69eb2 00000000
      [   46.888037]  f4783cdc f57f0070 f759c590 1001c580 00000003 0200000a 00000000 f5a88560
      [   46.888037]  f5ba2600 f5a88560 00000041 00000000 f55c5d90 f8c6f4c7 00000008 f55c5cf2
      [   46.888037] Call Trace:
      [   46.888037]  [<f8c6a54c>] l2cap_send_cmd+0x1cc/0x230 [bluetooth]
      [   46.888037]  [<f8c69eb2>] ? l2cap_global_chan_by_psm+0x152/0x1a0 [bluetooth]
      [   46.888037]  [<f8c6f4c7>] l2cap_connect+0x3f7/0x540 [bluetooth]
      [   46.888037]  [<c019b37b>] ? trace_hardirqs_off+0xb/0x10
      [   46.888037]  [<c01a0ff8>] ? mark_held_locks+0x68/0x110
      [   46.888037]  [<c064ad20>] ? mutex_lock_nested+0x280/0x360
      [   46.888037]  [<c064b9d9>] ? __mutex_unlock_slowpath+0xa9/0x150
      [   46.888037]  [<c01a118c>] ? trace_hardirqs_on_caller+0xec/0x1b0
      [   46.888037]  [<c064ad08>] ? mutex_lock_nested+0x268/0x360
      [   46.888037]  [<c01a125b>] ? trace_hardirqs_on+0xb/0x10
      [   46.888037]  [<f8c72f8d>] l2cap_recv_frame+0xb2d/0x1d30 [bluetooth]
      [   46.888037]  [<c01a0ff8>] ? mark_held_locks+0x68/0x110
      [   46.888037]  [<c064b9d9>] ? __mutex_unlock_slowpath+0xa9/0x150
      [   46.888037]  [<c01a118c>] ? trace_hardirqs_on_caller+0xec/0x1b0
      [   46.888037]  [<f8c754f1>] l2cap_recv_acldata+0x2a1/0x320 [bluetooth]
      [   46.888037]  [<f8c491d8>] hci_rx_work+0x518/0x810 [bluetooth]
      [   46.888037]  [<f8c48df2>] ? hci_rx_work+0x132/0x810 [bluetooth]
      [   46.888037]  [<c0158979>] process_one_work+0x1a9/0x600
      [   46.888037]  [<c01588fb>] ? process_one_work+0x12b/0x600
      [   46.888037]  [<c015922e>] ? worker_thread+0x19e/0x320
      [   46.888037]  [<c015922e>] ? worker_thread+0x19e/0x320
      [   46.888037]  [<c0159187>] worker_thread+0xf7/0x320
      [   46.888037]  [<c0159090>] ? rescuer_thread+0x290/0x290
      [   46.888037]  [<c01602f8>] kthread+0xa8/0xb0
      [   46.888037]  [<c0656777>] ret_from_kernel_thread+0x1b/0x28
      [   46.888037]  [<c0160250>] ? flush_kthread_worker+0x120/0x120
      [   46.888037] Code: c3 90 8d 74 26 00 e8 63 fc ff ff eb e8 90 55 89 e5 83 ec 0c 89 5d f4 89 75 f8 89 7d fc 3e 8d 74 26 00 89 cb 89 c7 c1 e9 02 89 d6 <f3> a5 89 d9 83 e1 03 74 02 f3 a4 8b 5d f4 8b 75 f8 8b 7d fc 89
      [   46.888037] EIP: [<c03d94cd>] memcpy+0x1d/0x40 SS:ESP 0068:f55c5c5c
      [   46.888037] CR2: 00000000f56ad000
      [   46.888037] ---[ end trace 0217c1f4d78714a9 ]---
      Signed-off-by: NAnderson Lizardo <anderson.lizardo@openbossa.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      300b962e
  3. 12 6月, 2013 6 次提交
  4. 11 6月, 2013 6 次提交