summaryrefslogtreecommitdiffstats
path: root/net/nfc/llcp
Commit message (Collapse)AuthorAgeFilesLines
* NFC: Move LLCP code to the NFC top level diirectorySamuel Ortiz2013-04-265-3740/+0
| | | | | | | And stop making it optional. LLCP is a fundamental part of the NFC specifications and making it optional does not make much sense. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: llcp: Terminate connection when receiving a DISC on (0,0)Samuel Ortiz2013-04-111-0/+6
| | | | | | | According to the LLCP specs, we must terminate the LLCP link when receiving a DISC with both ssap and dsap set to 0. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: llcp: Remove local_cleanup last argumentSamuel Ortiz2013-04-111-4/+4
| | | | | | | local_cleanup is always called with device set to false as it means the local LLCP is going away. So no need to pass this switch as an argument. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: llcp: Only keep raw sockets alive when the LLCP local leavesSamuel Ortiz2013-04-111-23/+3
| | | | | | | | When the MAC goes down, connected and connection less sockets should be notified, but raw sockets should be kept alive. They will get notified only when the physical devices goes away. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: llcp: Add support in getsockopt for RW, LTO, and MIU remote parametersThierry Escande2013-04-111-1/+22
| | | | | | | Useful for LLCP validation tests. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: llcp: Reset RW, LTO, and MIU remote parameters when link goes downThierry Escande2013-04-113-2/+13
| | | | | | | | | This resets remote parameters in both local and socket llcp structures when the link goes down. That way, nfc_llcp_getsockopt won't return values corresponding to the previous link parameters. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: llcp: Use localy stored remote_miu value if not set at socket levelThierry Escande2013-04-113-3/+12
| | | | | | | | If remote_miu value is not set in the socket (i.e. connection-less socket) the value stored in the local is used. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: llcp: Aggregated frames supportThierry Escande2013-04-112-12/+69
| | | | | | | | This adds support for AGF PDUs. For each PDU contained in the AGF, a new sk_buff is allocated and dispatched to its corresponding handler. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: llcp: Fix zero octets length SDU handlingOlivier Guiter2013-04-111-8/+8
| | | | | | | | LLCP Validation test #2 (Connection-less information transfer) send a service data unit of zero octets length. This is now handled correctly. Signed-off-by: Olivier Guiter <olivier.guiter@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: llcp: Fall back to local values when getting socket optionsSamuel Ortiz2013-04-111-3/+13
| | | | | | | If a socket option has not been set by the user, fall back to the LLCP local ones. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: llcp: Socket miux is a big endian fieldSamuel Ortiz2013-04-113-6/+9
| | | | | | | The MIUX must be transmitted in big endian and as such we have to convert it properly. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* Merge branch 'master' of ↵John W. Linville2013-04-102-11/+3
|\ | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless Conflicts: drivers/net/wireless/rt2x00/rt2x00pci.c
| * NFC: llcp: Keep the connected socket parent pointer aliveSamuel Ortiz2013-03-261-1/+3
| | | | | | | | | | | | | | And avoid decreasing the ack log twice when dequeueing connected LLCP sockets. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: llcp: Remove possible double call to kfree_skbThierry Escande2013-03-201-2/+0
| | | | | | | | | | | | | | kfree_skb was called twice when the socket receive queue is full Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: llcp: Detach socket from process context only when releasing the socketSamuel Ortiz2013-03-202-8/+0
| | | | | | | | | | | | | | | | Calling sock_orphan when e.g. the NFC adapter is removed can lead to kernel crashes when e.g. a connection less client is sleeping on the Rx workqueue, waiting for data to show up. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | Merge branch 'master' of ↵John W. Linville2013-03-182-9/+55
|\ \ | |/ | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless Conflicts: net/nfc/llcp/llcp.c
| * NFC: llcp: Report error to pending sockets when a device is removedSamuel Ortiz2013-03-081-4/+12
| | | | | | | | Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: llcp: Clean raw sockets from nfc_llcp_socket_releaseSamuel Ortiz2013-03-081-0/+29
| | | | | | | | Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: llcp: Clean local timers and works when removing a deviceSamuel Ortiz2013-03-081-7/+14
| | | | | | | | | | | | | | | | | | Whenever an adapter is removed we must clean all the local structures, especially the timers and scheduled work. Otherwise those asynchronous threads will eventually try to access the freed nfc_dev pointer if an LLCP link is up. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: llcp: Decrease socket ack log when accepting a connectionSamuel Ortiz2013-03-081-0/+2
| | | | | | | | | | | | | | This is really difficult to test with real NFC devices, but without this fix an LLCP server will eventually refuse new connections. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: llcp: Add cleanup support for unreplied SNL requestsThierry Escande2013-03-103-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | If the remote LLC doesn't reply in time to our SNL requests we remove them from the list of pending requests. The timeout is fixed to an arbitrary value of 3 times remote_lto. When not replied, the local LLC broadcasts NFC_EVENT_LLC_SDRES nl events for the concerned uris with sap values set to LLCP_SDP_UNBOUND (which is 65). Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: llcp: Service Name Lookup netlink interfaceThierry Escande2013-03-103-0/+119
| | | | | | | | | | | | | | | | | | | | | | | | This adds a netlink interface for service name lookup support. Multiple URIs can be passed nested into the NFC_ATTR_LLC_SDP attribute using the NFC_CMD_LLC_SDREQ netlink command. When the SNL reply is received, a NFC_EVENT_LLC_SDRES event is sent to the user space. URI and SAP tuples are passed back, nested into NFC_ATTR_LLC_SDP attribute. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: llcp: Service Name Lookup SDRES aggregationThierry Escande2013-03-103-27/+94
| | | | | | | | | | | | | | | | | | This modifies the way SDRES PDUs are sent back. If multiple SDREQs are received within a single SNL PDU, all SDRES replies are sent packed in one SNL PDU too. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: llcp: Remove redundant printkSamuel Ortiz2013-03-101-2/+0
| | | | | | | | | | | | We already have a pr_debug for that. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: llcp: Use socket specific link parameters before the local onesSamuel Ortiz2013-03-103-8/+23
| | | | | | | | | | | | If the socket link options are set, use them before the local one. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: llcp: Implement socket optionsSamuel Ortiz2013-03-102-2/+120
| | | | | | | | | | | | | | | | Some LLCP services (e.g. the validation ones) require some control over the LLCP link parameters like the receive window (RW) or the MIU extension (MIUX). This can only be done through socket options. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | NFC: llcp: Rename socket rw and miu fieldsSamuel Ortiz2013-03-104-16/+19
|/ | | | | | | They really are remote peer parameters, and we need to distinguish them from the local ones as we'll modify the latter with socket options. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* hlist: drop the node parameter from iteratorsSasha Levin2013-02-271-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm not sure why, but the hlist for each entry iterators were conceived list_for_each_entry(pos, head, member) The hlist ones were greedy and wanted an extra parameter: hlist_for_each_entry(tpos, pos, head, member) Why did they need an extra pos parameter? I'm not quite sure. Not only they don't really need it, it also prevents the iterator from looking exactly like the list iterator, which is unfortunate. Besides the semantic patch, there was some manual work required: - Fix up the actual hlist iterators in linux/list.h - Fix up the declaration of other iterators based on the hlist ones. - A very small amount of places were using the 'node' parameter, this was modified to use 'obj->member' instead. - Coccinelle didn't handle the hlist_for_each_entry_safe iterator properly, so those had to be fixed up manually. The semantic patch which is mostly the work of Peter Senna Tschudin is here: @@ iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host; type T; expression a,c,d,e; identifier b; statement S; @@ -T b; <+... when != b ( hlist_for_each_entry(a, - b, c, d) S | hlist_for_each_entry_continue(a, - b, c) S | hlist_for_each_entry_from(a, - b, c) S | hlist_for_each_entry_rcu(a, - b, c, d) S | hlist_for_each_entry_rcu_bh(a, - b, c, d) S | hlist_for_each_entry_continue_rcu_bh(a, - b, c) S | for_each_busy_worker(a, c, - b, d) S | ax25_uid_for_each(a, - b, c) S | ax25_for_each(a, - b, c) S | inet_bind_bucket_for_each(a, - b, c) S | sctp_for_each_hentry(a, - b, c) S | sk_for_each(a, - b, c) S | sk_for_each_rcu(a, - b, c) S | sk_for_each_from -(a, b) +(a) S + sk_for_each_from(a) S | sk_for_each_safe(a, - b, c, d) S | sk_for_each_bound(a, - b, c) S | hlist_for_each_entry_safe(a, - b, c, d, e) S | hlist_for_each_entry_continue_rcu(a, - b, c) S | nr_neigh_for_each(a, - b, c) S | nr_neigh_for_each_safe(a, - b, c, d) S | nr_node_for_each(a, - b, c) S | nr_node_for_each_safe(a, - b, c, d) S | - for_each_gfn_sp(a, c, d, b) S + for_each_gfn_sp(a, c, d) S | - for_each_gfn_indirect_valid_sp(a, c, d, b) S + for_each_gfn_indirect_valid_sp(a, c, d) S | for_each_host(a, - b, c) S | for_each_host_safe(a, - b, c, d) S | for_each_mesh_entry(a, - b, c, d) S ) ...+> [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c] [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c] [akpm@linux-foundation.org: checkpatch fixes] [akpm@linux-foundation.org: fix warnings] [akpm@linux-foudnation.org: redo intrusive kvm changes] Tested-by: Peter Senna Tschudin <peter.senna@gmail.com> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Cc: Wu Fengguang <fengguang.wu@intel.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: Gleb Natapov <gleb@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* NFC: llcp: integer underflow in nfc_llcp_set_remote_gb()Dan Carpenter2013-02-081-3/+2
| | | | | | | | | | | | | | If gb_len is less than 3 it would cause an integer underflow and possibly memory corruption in nfc_llcp_parse_gb_tlv(). I removed the old test for gb_len == 0. I also removed the test for ->remote_gb == NULL. It's not possible for ->remote_gb to be NULL and we have already dereferenced ->remote_gb_len so it's too late to test. The old test return -ENODEV but my test returns -EINVAL. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* NFC: Use skb_copy_datagram_iovecSamuel Ortiz2013-01-111-1/+1
| | | | | | Safer and more robust than than memcpy_toiovec. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: Avoid memcpy on LLCP connection less Rx pathSamuel Ortiz2013-01-111-8/+8
| | | | | | We can cast msg_name to a sockaddr_nfc_llcp pointer directly. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: llcp: Fix Rx memory leakSamuel Ortiz2013-01-101-10/+25
| | | | | | | | | | | | | The reference count bump on the llcp Rx path is leading to a memory leak whenever we're not receiving an I frame. We fix that by removing the refcount bump (drivers must not free their received skb) and using it only in the I frame path, when the frame is actually queued. In that case, the skb will only be freed when someone fetches it from userspace. in all other cases, LLCP received frames will be freed when leaving the Rx work queue. Reported-by: Eric Lapuyade <eric.lapuyade@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: llcp: Remove the tx backlog queueSamuel Ortiz2013-01-103-6/+2
| | | | | | | | Not only it was improperly use to queue backlogged RX skbuffs, but it was also not processed at all. If the socket receive queue is full we simply drop the incoming packets. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: Add support for SO_TIMESTAMP LLCP socket optionThierry Escande2013-01-103-0/+8
| | | | | | | | Set timestamp in sent and received sk_buffs. timestamp is then put in msghdr structure in llcp_sock_recvmsg(). Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* 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: Extend netlink interface for LTO, RW, and MIUX parameters supportThierry Escande2012-10-293-19/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 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: Fix some code style and whitespace issuesSzymon Janc2012-10-261-3/+4
| | | | | | | | | | Signed-off-by: Szymon Janc <szymon.janc@tieto.com> 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>
OpenPOWER on IntegriCloud