summaryrefslogtreecommitdiffstats
path: root/net/nfc
Commit message (Collapse)AuthorAgeFilesLines
* nfc: remove noisy message from llcp_sock_sendmsgDave Jones2012-12-131-4/+0
| | | | | | | | | This is easily triggerable when fuzz-testing as an unprivileged user. We could rate-limit it, but given we don't print similar messages for other protocols, I just removed it. Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge tag 'nfc-fixes-3.7-2' of ↵John W. Linville2012-12-061-1/+4
|\ | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-3.0 This is an NFC LLCP fix for 3.7 and contains only one patch. It fixes a potential crash when receiving an LLCP HDLC frame acking a frame that is not the last sent one. In that case we may dereference an already freed pointer.
| * NFC: Fix incorrect llcp pointer dereferenceWaldemar Rymarkiewicz2012-11-281-1/+4
| | | | | | | | | | | | | | | | | | nfc_llcp_ns(s) dereferences the s pointer which is freed a line above. In a result, it can produce a crash or you will read incorrect value. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | Merge branch 'master' of ↵John W. Linville2012-11-211-1/+1
|\ \ | |/ | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless Conflicts: drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c drivers/net/wireless/iwlwifi/pcie/tx.c
| * NFC: Fix nfc_llcp_local chained list insertionThierry Escande2012-11-201-1/+1
| | | | | | | | | | | | | | list_add was called with swapped parameters Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Queue a copy of the transmitted LLCP skbSamuel Ortiz2012-11-191-4/+13
| | | | | | | | | | | | | | | | | | | | Drivers are allowed to modify the sent skb and thus we need to make a copy of it before passing it to the driver. Without this fix, LLCP Tx skbs were not queued properly as the ptype check was failing due to e.g. the pn533 driver skb_pushing the Tx skb. Reported-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Stop sending LLCP frames when tx queues are getting too deepSamuel Ortiz2012-11-191-0/+17
| | | | | | | | | | | | | | | | When the tx pending queues and/or the socket tx queue is getting too deep, we have to let userspace know. We won't be queueing any more frames until the congestion is fixed. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Copy user space buffer when sending UI framesSamuel Ortiz2012-11-191-2/+13
| | | | | | | | | | | | | | Using the userspace IO vector directly is wrong, we should copy it from user space first. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Export nfc_hci_sak_to_protocol()Eric Lapuyade2012-11-191-1/+2
| | | | | | | | | | | | | | Some HCI drivers will need it. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Export nfc_hci_result_to_errno as it can be needed by HCI driversEric Lapuyade2012-11-191-1/+2
| | | | | | | | | | Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Dot not dispatch HCI event received on unopened pipeEric Lapuyade2012-11-191-5/+8
| | | | | | | | | | | | | | | | A chip with pre-opened gates may send events on a gate that nobody has opened in the handset host. Discard those events. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Ignore err when chip doesn't implement HW/SW info registersEric Lapuyade2012-11-191-0/+6
| | | | | | | | | | | | | | | | | | NFC_HCI_ID_MGMT_VERSION_SW and NFC_HCI_ID_MGMT_VERSION_HW are optional registers for gate NFC_HCI_ID_MGMT_GATE in standard HCI. When chip doesn't implement, just leave all the information as zeros. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Fix hci_connect_gate() when a pre-opened pipe is passedEric Lapuyade2012-11-191-2/+2
| | | | | | | | | | | | | | | | | | | | In some cases, pre-opened pipes don't stay open when a clear all pipes command is sent. They stay created however. Therefore, one can never assume that such a pipe is already open. As re-opening a pipe seems not to be a problem, we do that now. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Extend netlink interface for LTO, RW, and MIUX parameters supportThierry Escande2012-10-295-19/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | NFC_CMD_LLC_GET_PARAMS: request LTO, RW, and MIUX parameters for a device NFC_CMD_LLC_SET_PARAMS: set one or more of LTO, RW, and MIUX parameters for a device. LTO must be set before the link is up otherwise -EINPROGRESS is returned. RW and MIUX can be set at anytime and will be passed in subsequent CONNECT and CC messages. If one of the passed parameters is wrong none is set and -EINVAL is returned. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Purge LLCP socket Tx queues when being disconnectedSamuel Ortiz2012-10-261-0/+31
| | | | | | | | | | | | | | | | The Tx queues are no longer valid when we receive a disconnection or when the LLCP link goes down. In the later case we also purge the entire local Tx queue. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Remove CONFIG_EXPERIMENTAL from the NCI MakefileKees Cook2012-10-261-2/+2
| | | | | | | | | | | | | | | | | | | | This config item has not carried much meaning for a while now and is almost always enabled by default. As agreed during the Linux kernel summit, remove it. Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Remove CONFIG_EXPERIMENTAL from the LLCP MakefileKees Cook2012-10-261-2/+2
| | | | | | | | | | | | | | | | | | | | This config item has not carried much meaning for a while now and is almost always enabled by default. As agreed during the Linux kernel summit, remove it. Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Remove CONFIG_EXPERIMENTALKees Cook2012-10-261-2/+2
| | | | | | | | | | | | | | | | | | | | This config item has not carried much meaning for a while now and is almost always enabled by default. As agreed during the Linux kernel summit, remove it. Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Fix some code style and whitespace issuesSzymon Janc2012-10-268-17/+17
| | | | | | | | | | Signed-off-by: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Use IDR library to assing NFC devices IDsSamuel Ortiz2012-10-261-7/+16
| | | | | | | | | | | | | | As a consequence the NFC device IDs won't be increasing all the time, as IDR provides the first available ID. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Return NULL when no LLCP socket for a dsap,ssap couple is foundSamuel Ortiz2012-10-261-4/+6
| | | | | | | | | | | | | | The previous code was always returning the last socket from the LLCP socket list. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Implement LLCP connection less Tx pathSamuel Ortiz2012-10-261-0/+19
| | | | | | | | | | | | | | It simply involves getting the client dsap and ssap and calling the UI frame building and sending routine. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: UI frame sending routine implementationSamuel Ortiz2012-10-262-0/+48
| | | | | | | | | | | | | | UI frames still need to follow the MIU rule, and they need to use the client passed dsap as the listening socket dsap is stuck on SDP. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Forward LLCP datagrams to userspaceSamuel Ortiz2012-10-261-1/+18
| | | | | | | | | | | | With connection less PDUs we have to send the SSAP and DSAP as well. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Handle LLCP UI framesSamuel Ortiz2012-10-262-0/+45
| | | | | | | | | | | | | | UI (Unnumbered Information) frames are used for sending data over connection less links. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Keep connection less bound sockets alive when DEP link goes downSamuel Ortiz2012-10-261-0/+10
| | | | | | | | | | | | | | | | When DEP goes down, bound cl sockets can be kept alive as there is no reason to kill a connection less server socket because the LLCP link went down. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Check for connection less sockets when looking for a service nameSamuel Ortiz2012-10-261-1/+6
| | | | | | | | | | | | Connection less server sockets will be in BOUND state, not LISTEN. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Reserve LLCP ssap when replying to an SNL frameSamuel Ortiz2012-10-261-6/+40
| | | | | | | | | | | | | | | | Replying to an SNL (Service Name Lookup) means that the other end of the link can now rely on our answer (Which is an ssap) and thus we have to reserve it. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Fix sparse warnings due to missing staticArron Wang2012-10-261-1/+1
| | | | | | | | | | Signed-off-by: Arron Wang <arron.wang@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Fix style issues with logical operationsSzymon Janc2012-10-262-10/+10
| | | | | | | | | | | | | | Logical continuations should be on the previous line. Signed-off-by: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Fix not propagating return code in nfc_hci_clear_all_pipesSzymon Janc2012-10-261-6/+2
| | | | | | | | | | | | | | Return code from nfc_hci_execute_cmd was not propagated to caller. Signed-off-by: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Small nfc_hci_create_pipe refactoringSzymon Janc2012-10-261-8/+8
| | | | | | | | | | | | | | | | Check for error and return if any. This makes it easier to see what is a 'positive' function flow. Signed-off-by: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Remove unneeded LLCP function return callsSzymon Janc2012-10-261-9/+0
| | | | | | | | | | | | | | | | There is no need for return statement at the end of function returning void. Signed-off-by: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Remove not needed local variable in nci_set_local_general_bytesSzymon Janc2012-10-261-6/+4
| | | | | | | | | | | | | | | | No need for local rc variable as result of nci_request can be returned directly. Signed-off-by: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Use NFC_MAX_GT_LEN to check len in nci_set_local_general_bytesSzymon Janc2012-10-261-1/+1
| | | | | | | | | | | | | | | | | | local_gb is of size NFC_MAX_GT_LEN and len is used as index for it. Check len against this instead of NCI_MAX_PARAM_LEN before accessing local_gb. Signed-off-by: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Add NFC_ATTR_RF_MODE when sending device netlink propertiesThierry Escande2012-10-261-1/+2
| | | | | | | | | | | | | | | | This is useful when getting devices to know if they're in target or initiator mode. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Set rf_mode to NFC_RF_NONE where necessaryThierry Escande2012-10-261-0/+5
| | | | | | | | | | | | | | | | rf_mode is now set to NFC_RF_NONE when a device gets allocated, when the link goes down, and when stop polling. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Initial SNL supportSamuel Ortiz2012-10-261-0/+65
| | | | | | | | | | | | | | | | | | | | SNL (Service Name Lookup) allows for LLCP peers to map service names with SAPs. This is mandatory for connection less support as peers need to get the right SAPs without sending the CONNECT frame. Here we only support the Rx part of SNL. The Tx one will be implemented when supporting connection less LLCP sockets. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Add SNL frame building routineSamuel Ortiz2012-10-262-0/+47
| | | | | | | | | | | | | | SNL (Service Name Lookup) frames are used to respond to SNL requests. This is needed for SDP implementation. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Use llcp_allocate_pdu to build the DISC framesSamuel Ortiz2012-10-261-9/+1
| | | | | | | | | | | | | | We no longer need to be atomic as this is only called from llcp_sock_release(). Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Avoid falling back to SYMM when sk is NULLSamuel Ortiz2012-10-261-3/+4
| | | | | | | | | | | | | | | | In some cases (SNL, DISC, DM) we need to send an LLCP skbs without having a sock owning it. I frames are an exception here since they may be requeued to the llcp_sock queue. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: HCI check presence must not fail when driver doesn't support itEric Lapuyade2012-10-261-0/+3
| | | | | | | | | | | | | | | | | | When the driver does not support checking the tag is still present, it must return -EOPNOTSUPP. The NFC Core will then stop asking and not report a tag lost event to user space. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Implement HCI DEP send and receive dataArron Wang2012-10-261-4/+15
| | | | | | | | | | | | | | And implement the corresponding hooks for pn544. Signed-off-by: Arron Wang <arron.wang@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Implement HCI DEP link up and downArron Wang2012-10-261-0/+24
| | | | | | | | | | | | | | And implement the corresponding hooks for pn544. Signed-off-by: Arron Wang <arron.wang@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Handle pn544 continue activationArron Wang2012-10-261-1/+3
| | | | | | | | | | | | | | | | | | We need to send continue activation command to allow NFCIP-1 activation when a NFC target has been discovered in type A or type F reader gate. Signed-off-by: Arron Wang <arron.wang@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: Pass hardware specific HCI event to driverArron Wang2012-10-261-3/+9
|/ | | | | Signed-off-by: Arron Wang <arron.wang@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* Remove noisy printks from llcp_sock_connectDave Jones2012-10-041-6/+2
| | | | | | | Validation of userspace input shouldn't trigger dmesg spamming. Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* workqueue: avoid using deprecated functionsLinus Torvalds2012-10-025-18/+18
| | | | | | | | | | | | | The network merge brought in a few users of functions that got deprecated by the workqueue cleanups: the 'system_nrt_wq' is now the same as the regular system_wq, since all workqueues are now non- reentrant. Similarly, remove one use of flush_work_sync() - the regular flush_work() has become synchronous, and the "_sync()" version is thus deprecated as being superfluous. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Merge branch 'master' of ↵John W. Linville2012-09-2818-579/+1157
|\ | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem Conflicts: net/nfc/netlink.c Signed-off-by: John W. Linville <linville@tuxdriver.com>
| * NFC: Fix sleeping in atomic when releasing socketSzymon Janc2012-09-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nfc_llcp_socket_release is calling lock_sock/release_sock while holding write lock for rwlock. Use bh_lock/unlock_sock instead. BUG: sleeping function called from invalid context at net/core/sock.c:2138 in_atomic(): 1, irqs_disabled(): 0, pid: 56, name: kworker/1:1 4 locks held by kworker/1:1/56: Pid: 56, comm: kworker/1:1 Not tainted 3.5.0-999-nfc+ #7 Call Trace: [<ffffffff810952c5>] __might_sleep+0x145/0x200 [<ffffffff815d7686>] lock_sock_nested+0x36/0xa0 [<ffffffff81731569>] ? _raw_write_lock+0x49/0x50 [<ffffffffa04aa100>] ? nfc_llcp_socket_release+0x30/0x200 [nfc] [<ffffffffa04aa122>] nfc_llcp_socket_release+0x52/0x200 [nfc] [<ffffffffa04ab9f0>] nfc_llcp_mac_is_down+0x20/0x30 [nfc] [<ffffffffa04a6fea>] nfc_dep_link_down+0xaa/0xf0 [nfc] [<ffffffffa04a9bb5>] nfc_llcp_timeout_work+0x15/0x20 [nfc] [<ffffffff810825f7>] process_one_work+0x197/0x7c0 [<ffffffff81082596>] ? process_one_work+0x136/0x7c0 [<ffffffff8172fbc9>] ? __schedule+0x419/0x9c0 [<ffffffffa04a9ba0>] ? nfc_llcp_build_gb+0x1b0/0x1b0 [nfc] [<ffffffff81083090>] worker_thread+0x190/0x4c0 [<ffffffff81082f00>] ? rescuer_thread+0x2a0/0x2a0 [<ffffffff81088d1e>] kthread+0xae/0xc0 [<ffffffff810caafd>] ? trace_hardirqs_on+0xd/0x10 [<ffffffff8173acc4>] kernel_thread_helper+0x4/0x10 [<ffffffff81732174>] ? retint_restore_args+0x13/0x13 [<ffffffff81088c70>] ? flush_kthread_worker+0x150/0x150 [<ffffffff8173acc0>] ? gs_change+0x13/0x13 Signed-off-by: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
OpenPOWER on IntegriCloud