summaryrefslogtreecommitdiffstats
path: root/net/nfc
Commit message (Collapse)AuthorAgeFilesLines
...
| * NFC: Fix sleeping in invalid context when netlink socket is closedSzymon Janc2012-09-271-7/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | netlink_register_notifier requires notify functions to not sleep. nfc_stop_poll locks device mutex and must not be called from notifier. Create workqueue that will handle this for all devices. BUG: sleeping function called from invalid context at kernel/mutex.c:269 in_atomic(): 0, irqs_disabled(): 0, pid: 4497, name: neard 1 lock held by neard/4497: Pid: 4497, comm: neard Not tainted 3.5.0-999-nfc+ #5 Call Trace: [<ffffffff810952c5>] __might_sleep+0x145/0x200 [<ffffffff81743dde>] mutex_lock_nested+0x2e/0x50 [<ffffffff816ffd19>] nfc_stop_poll+0x39/0xb0 [<ffffffff81700a17>] nfc_genl_rcv_nl_event+0x77/0xc0 [<ffffffff8174aa8c>] notifier_call_chain+0x5c/0x120 [<ffffffff8174abd6>] __atomic_notifier_call_chain+0x86/0x140 [<ffffffff8174ab50>] ? notifier_call_chain+0x120/0x120 [<ffffffff815e1347>] ? skb_dequeue+0x67/0x90 [<ffffffff8174aca6>] atomic_notifier_call_chain+0x16/0x20 [<ffffffff8162119a>] netlink_release+0x24a/0x280 [<ffffffff815d7aa8>] sock_release+0x28/0xa0 [<ffffffff815d7be7>] sock_close+0x17/0x30 [<ffffffff811b2a7c>] __fput+0xcc/0x250 [<ffffffff811b2c0e>] ____fput+0xe/0x10 [<ffffffff81085009>] task_work_run+0x69/0x90 [<ffffffff8101b951>] do_notify_resume+0x81/0xd0 [<ffffffff8174ef22>] int_signal+0x12/0x17 Signed-off-by: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Add dummy nfc_llc_shdlc_register definitionJohn W. Linville2012-09-271-0/+8
| | | | | | | | | | | | | | | | This is used when CONFIG_NFC_SHDLC is disabled. Reported-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: LLCP raw socket supportThierry Escande2012-09-274-4/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for socket of type SOCK_RAW to LLCP. sk_buff are copied and sent to raw sockets with a 2 bytes extra header: The first byte header contains the nfc adapter index. The second one contains flags: - 0x01 - Direction (0=RX, 1=TX) - 0x02-0x80 - Reserved A raw socket has to be explicitly bound to a nfc adapter. This is achieved by specifying the adapter index to be bound to in the dev_idx field of the sockaddr_nfc_llcp struct passed to bind(). Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Use dynamic initialization for rwlocksSzymon Janc2012-09-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If rwlock is dynamically allocated but statically initialized it is missing proper lockdep annotation. INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. Pid: 3352, comm: neard Not tainted 3.5.0-999-nfc+ #2 Call Trace: [<ffffffff810c8526>] __lock_acquire+0x8f6/0x1bf0 [<ffffffff81739045>] ? printk+0x4d/0x4f [<ffffffff810c9eed>] lock_acquire+0x9d/0x220 [<ffffffff81702bfe>] ? nfc_llcp_sock_from_sn+0x4e/0x160 [<ffffffff81746724>] _raw_read_lock+0x44/0x60 [<ffffffff81702bfe>] ? nfc_llcp_sock_from_sn+0x4e/0x160 [<ffffffff81702bfe>] nfc_llcp_sock_from_sn+0x4e/0x160 [<ffffffff817034a7>] nfc_llcp_get_sdp_ssap+0xa7/0x1b0 [<ffffffff81706353>] llcp_sock_bind+0x173/0x210 [<ffffffff815d9c94>] sys_bind+0xe4/0x100 [<ffffffff8139209e>] ? trace_hardirqs_on_thunk+0x3a/0x3f [<ffffffff8174ea69>] system_call_fastpath+0x16/0x1b Signed-off-by: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Fix typo negociating -> negotiatingWaldemar Rymarkiewicz2012-09-251-5/+5
| | | | | | | | | | Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Don't handle consequent RSET frames after UAWaldemar Rymarkiewicz2012-09-251-7/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | During processing incoming RSET frame chip, possibly due to its internal timout, can retrnasmit an another RSET which is next queued for processing in shdlc layer. In case when we accept processed RSET skip those remaining on the rcv queue until chip will send it's first S or I frame. This will mean the chip completed connection as well. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Handle RSET in SHDLC_CONNECTING stateWaldemar Rymarkiewicz2012-09-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | As queue_work() does not guarantee immediate execution of sm_work it can happen in crossover RSET usecase that connect timer will constantly change the shdlc state from NEGOTIATING to CONNECTING before shdlc has chance to handle incoming frame. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Acked-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Add HCI module descriptionEric Lapuyade2012-09-251-0/+1
| | | | | | | | | | Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Fix LLC registration definitions for ANSI complianceEric Lapuyade2012-09-252-2/+2
| | | | | | | | | | Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Remove unneeded LLC symbols exportSamuel Ortiz2012-09-253-17/+1
| | | | | | | | | | | | After fixing the LLC Makefile, we no longer need those exports. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Changed HCI and PN544 HCI driver to use the new HCI LLC CoreEric Lapuyade2012-09-254-1009/+123
| | | | | | | | | | | | | | | | | | | | | | The previous shdlc HCI driver and its header are removed from the tree. PN544 now registers directly with HCI and passes the name of the llc it requires (shdlc). HCI instantiation now allocates the required llc instance. The llc is started when the HCI device is brought up. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Add an shdlc llc module to llc coreEric Lapuyade2012-09-254-2/+851
| | | | | | | | | | | | | | | | This is used by HCI drivers such as the one for the pn544 which require communications between HCI and the chip to use shdlc. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Add a nop (passthrough) llc module to llc coreEric Lapuyade2012-09-254-2/+105
| | | | | | | | | | | | | | | | | | | | This is a passthrough llc. It can be used by HCI drivers that don't need link layer control. HCI will then write directly to the driver, and driver will deliver incoming frames directly to HCI without any processing. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Add an LLC Core layer to HCIEric Lapuyade2012-09-254-1/+241
| | | | | | | | | | | | | | | | | | The LLC layer manages modules that control the link layer protocol (such as shdlc) between HCI and an HCI driver. The driver must simply specify the required llc when it registers with HCI. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Modified hci_transceive to become an asynchronous operationEric Lapuyade2012-09-252-20/+42
| | | | | | | | | | | | | | | | | | | | | | This enables the completion callback to be called from a different context, preventing a possible deadlock if the callback resulted in the invocation of a nested call to the currently locked nfc_dev. This is also more in line with the im_transceive nfc_ops for NFC Core or NCI drivers which already behave asynchronously. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Add a public nfc_hci_send_cmd_async methodEric Lapuyade2012-09-251-1/+33
| | | | | | | | | | | | | | | | This method initiates execution of an HCI cmd. Result will be delivered through an asynchronous callback. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Changed the HCI cmd execution callback prototypeEric Lapuyade2012-09-254-24/+21
| | | | | | | | | | | | | | | | Make it match the data_exchange_cb_t so that it can be used directly in the implementation of an asynchronous hci_transceive Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Correct outgoing frame before requeueingWaldemar Rymarkiewicz2012-09-251-2/+1
| | | | | | | | | | | | | | | | | | Driver must handle its data added to the frame, so at this point removeing control field of shdlc frame is enough. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Acked-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Remove crc generation from shdlc layerWaldemar Rymarkiewicz2012-09-251-25/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Checksum is specific for a chip spcification and it varies (in size and type) between different hardware. It should be handled in the driver then. Moreover, shdlc spec doesn't mention crc as a part of the frame. Update pn544_hci driver as well. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Acked-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Fix possible LLCP memory leakWei Yongjun2012-09-251-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | nfc_llcp_build_tlv() malloced the memory and should be free in nfc_llcp_build_gb() after used, and the same in the error handling case, otherwise it will cause memory leak. spatch with a semantic match is used to found this problem. (http://coccinelle.lip6.fr/) Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Remove pointless conditional before HCI kfree_skb()Wei Yongjun2012-09-252-4/+2
| | | | | | | | | | Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Use system_nrt_wq instead of custom onesTejun Heo2012-09-256-118/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | NFC is using a number of custom ordered workqueues w/ WQ_MEM_RECLAIM. WQ_MEM_RECLAIM is unnecessary unless NFC is gonna be used as transport for storage device, and all use cases match one work item to one ordered workqueue - IOW, there's no actual ordering going on at all and using system_nrt_wq gives the same behavior. There's nothing to be gained by using custom workqueues. Use system_nrt_wq instead and drop all the custom ones. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Remove repeated code for NULL checkSyam Sidhardhan2012-09-251-3/+0
| | | | | | | | | | | | | | | | This patch remove the repeated code for checking llcp_sock & llcp_sock->dev against NULL. Signed-off-by: Syam Sidhardhan <s.syam@samsung.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Implement NCI dep_link_up and dep_link_downIlan Elias2012-09-252-1/+55
| | | | | | | | | | | | | | | | | | | | | | During NFC-DEP target activation, store the remote general bytes to be used later in dep_link_up. When dep_link_up is called, activate the NFC-DEP target, and forward the remote general bytes. When dep_link_down is called, deactivate the target. Signed-off-by: Ilan Elias <ilane@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Parse NCI NFC-DEP activation paramsIlan Elias2012-09-251-0/+32
| | | | | | | | | | Signed-off-by: Ilan Elias <ilane@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Set local general bytes in nci_start_pollIlan Elias2012-09-252-0/+69
| | | | | | | | | | | | | | | | If initiator protocol is NFC-DEP, set the local general bytes in nci_start_poll. Signed-off-by: Ilan Elias <ilane@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | netlink: Rename pid to portid to avoid confusionEric W. Biederman2012-09-101-13/+13
|/ | | | | | | | | | | | | | | It is a frequent mistake to confuse the netlink port identifier with a process identifier. Try to reduce this confusion by renaming fields that hold port identifiers portid instead of pid. I have carefully avoided changing the structures exported to userspace to avoid changing the userspace API. I have successfully built an allyesconfig kernel with this change. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge branch 'master' of ↵John W. Linville2012-07-203-4/+21
|\ | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
| * Merge branch 'master' of ↵John W. Linville2012-07-173-4/+21
| |\ | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
| | * NFC: NCI module license 'unspecified' taints kernelDave Jones2012-07-121-0/+3
| | | | | | | | | | | | | | | | | | Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
| | * NFC: Set target nfcid1 for all HCI reader A targetsEric Lapuyade2012-07-121-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without the discovered target nfcid1 and its length set properly, type 2 tags detection fails with the pn544 as it checks for them from pn544_hci_complete_target_discovered(). Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Reported-by: Mathias Jeppsson <mathias.jeppsson@sonymobile.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
| | * NFC: Fix order of arguments to list_add_tail() when queueing HCP framesMathias Jeppsson2012-07-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The HCP message should be added to transmit queue, not the other way around. Signed-off-by: Mathias Jeppsson <mathias.jeppsson@sonymobile.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
| | * NFC: Fix empty HCI message list checkMathias Jeppsson2012-07-101-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | list_first_entry() will never return NULL. Instead use list_for_each_entry_safe() to iterate through the list. Signed-off-by: Mathias Jeppsson <mathias.jeppsson@sonymobile.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* | | Merge branch 'master' of ↵John W. Linville2012-07-1211-223/+392
|\ \ \ | |/ / | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
| * | NFC: Check for llcp_sock and its device from llcp_sock_getnameSamuel Ortiz2012-07-091-0/+3
| | | | | | | | | | | | | | | | | | They both can potentially be NULL. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Add ISO 14443 type B protocolSamuel Ortiz2012-07-093-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some devices (e.g. Sony's PaSoRi) can not do type B polling, so we have to make a distinction between ISO14443 type A and B poll modes. Cc: Eric Lapuyade <eric.lapuyade@intel.com> Cc: Ilan Elias <ilane@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Dereference LLCP bind socket address after checking for it to be NULLSamuel Ortiz2012-07-091-2/+2
| | | | | | | | | | | | | | | Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Do not return EBUSY when stopping a poll that's already stoppedSamuel Ortiz2012-07-091-0/+9
| | | | | | | | | | | | | | | | | | | | | We check for the polling flag before checking if the netlink PID caller match. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Remove warning from nfc_llcp_local_putSamuel Ortiz2012-07-091-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | The socket local pointer can be NULL when a socket is created but never bound or connected. Reported-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Handle LLCP Disconnected Mode framesSamuel Ortiz2012-07-091-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | When receiving such frame, the sockets waiting for a connection to finish should be woken up. Connecting to an unbound LLCP service will trigger a DM as a response. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: LLCP late bindingSamuel Ortiz2012-07-092-77/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the LLCP 16 local SAPs we can potentially quickly run out of source SAPs for non well known services. With the so called late binding we will reserve an SAP only when we actually get a client connection for a local service. The SAP will be released once the last client is gone, leaving it available to other services. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Forbid SSAP binding to a not well known LLCP serviceSamuel Ortiz2012-07-091-17/+5
| | | | | | | | | | | | | | | | | | | | | | | | With not Well Known Services there is no guarantees as to which SSAP the server will be listening on, so there is no reason to support binding to a specific source SAP. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Forbid LLCP service name reusingSamuel Ortiz2012-07-091-1/+3
| | | | | | | | | | | | | | | | | | | | | This patch fixes a typo and return the correct error when trying to bind 2 sockets to the same service name. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Release LLCP SAP when the owner is releasedSamuel Ortiz2012-07-093-14/+11
| | | | | | | | | | | | | | | | | | | | | | | | The LLCP SAP should only be freed when the socket owning it is released. As long as the socket is alive, the SAP should be reserved in order to e.g. send the right wks array when bringing the MAC up. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Close listening LLCP sockets when the device is goneSamuel Ortiz2012-07-091-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | When the MAC link goes down, we should only keep the bound sockets alive. They will be closed by sock_release or when the underlying NFC device is moving away. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Build LLCP general bytes upon requestSamuel Ortiz2012-07-091-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | Drivers will need them before starting a poll or when being activated as targets. Mostly WKS can have changed between device registration and then so we need to re-build the whole array. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Fix LLCP getname socket opSamuel Ortiz2012-07-091-4/+7
| | | | | | | | | | | | | | | | | | Set the right target index and use a better socket declaration routine. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Update LLCP socket target index when getting a connectionSamuel Ortiz2012-07-091-0/+1
| | | | | | | | | | | | | | | | | | Getting a valid CONNECT means we have a valid target index. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Add netlink module alias for NFCSamuel Ortiz2012-07-091-0/+3
| | | | | | | | | | | | Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * | NFC: Add modules alias for NFC socketsSamuel Ortiz2012-07-091-0/+1
| | | | | | | | | | | | Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
OpenPOWER on IntegriCloud