kernel-ark/net/nfc
Mark A. Greer 0529a7adf3 NFC: digital: Clear poll_tech_count before activating target
Currently, digital_target_found() has a race between
the events started by calling nfc_targets_found()
(which ultimately expect ddev->poll_tech_count to be
zero) and setting ddev->poll_tech_count to zero after
the call to nfc_targets_found().  When the race is
"lost" (i.e., ddev->poll_tech_count is found to not
be zero by the events started by nfc_targets_found()),
an error message is printed and the target is not found.
A similar race exists when digital_tg_recv_atr_req()
calls nfc_tm_activated().

Fix this by first saving the current value of
ddev->poll_tech_count and then clearing it before
calling nfc_targets_found()/nfc_tm_activated().
Clearing ddev->poll_tech_count before calling
nfc_targets_found()/nfc_tm_activated() eliminates
the race.  Saving the value is required so it can be
restored when nfc_targets_found()/nfc_tm_activated()
fails and polling needs to continue.

Acked-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-07-21 00:45:11 +02:00
..
hci NFC: hci: Fix sparse: cast to restricted __be16 2014-04-22 00:37:29 +02:00
nci NFC: NCI: Send all NCI frames to raw sockets 2014-05-20 00:23:59 +02:00
af_nfc.c nfc: Fix FSF address in file headers 2013-12-11 10:56:21 -05:00
core.c NFC: Move checking valid gb_len value to nfc_llcp_set_remote_gb 2014-03-14 20:19:08 +01:00
digital_core.c NFC: digital: Clear poll_tech_count before activating target 2014-07-21 00:45:11 +02:00
digital_dep.c NFC: digital: Clear poll_tech_count before activating target 2014-07-21 00:45:11 +02:00
digital_technology.c NFC: digital: Check for NFC-DEP before checking for Type 4 tag 2014-07-21 00:45:03 +02:00
digital.h NFC: digital: Add support for ISO/IEC 14443-B Protocol 2014-04-22 00:37:28 +02:00
Kconfig NFC Digital: Add NFC-F technology support 2013-09-25 02:02:25 +02:00
llcp_commands.c NFC: Add RAW socket type support for SOCKPROTO_RAW 2014-05-20 00:06:04 +02:00
llcp_core.c net: add __pskb_copy_fclone and pskb_copy_for_clone 2014-06-11 15:38:02 -07:00
llcp_sock.c net: add build-time checks for msg->msg_name size 2014-01-18 23:04:16 -08:00
llcp.h nfc: Fix FSF address in file headers 2013-12-11 10:56:21 -05:00
Makefile NFC Digital: Add initiator NFC-DEP support 2013-09-25 02:02:27 +02:00
netlink.c NFC: Add netlink support for ISO/IEC 15693 2014-02-16 23:49:53 +01:00
nfc.h NFC: Add RAW socket type support for SOCKPROTO_RAW 2014-05-20 00:06:04 +02:00
rawsock.c net: add __pskb_copy_fclone and pskb_copy_for_clone 2014-06-11 15:38:02 -07:00