diff options
author | Eric Lapuyade <eric.lapuyade@intel.com> | 2012-05-03 10:21:58 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-07-09 16:42:09 -0400 |
commit | 8668fdd6efb3a75e0d58a3287a47fa7e60a68a73 (patch) | |
tree | 27b4846b8243014391833f62937e4a2c20718a18 /net/nfc/core.c | |
parent | a070c8591a503ec65e2c84ebaf3454e5cd76e3fe (diff) |
NFC: Core must test the device polling state inside the device lock
There can ever be only one call to nfc_targets_found() after polling
has been engaged. This could be from a target discovered event from
the driver, or from an error handler to notify poll will never complete.
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/core.c')
-rw-r--r-- | net/nfc/core.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/net/nfc/core.c b/net/nfc/core.c index 32f28326b623..94ccf07374a5 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c | |||
@@ -571,13 +571,18 @@ int nfc_targets_found(struct nfc_dev *dev, | |||
571 | 571 | ||
572 | pr_debug("dev_name=%s n_targets=%d\n", dev_name(&dev->dev), n_targets); | 572 | pr_debug("dev_name=%s n_targets=%d\n", dev_name(&dev->dev), n_targets); |
573 | 573 | ||
574 | dev->polling = false; | ||
575 | |||
576 | for (i = 0; i < n_targets; i++) | 574 | for (i = 0; i < n_targets; i++) |
577 | targets[i].idx = dev->target_next_idx++; | 575 | targets[i].idx = dev->target_next_idx++; |
578 | 576 | ||
579 | device_lock(&dev->dev); | 577 | device_lock(&dev->dev); |
580 | 578 | ||
579 | if (dev->polling == false) { | ||
580 | device_unlock(&dev->dev); | ||
581 | return 0; | ||
582 | } | ||
583 | |||
584 | dev->polling = false; | ||
585 | |||
581 | dev->targets_generation++; | 586 | dev->targets_generation++; |
582 | 587 | ||
583 | kfree(dev->targets); | 588 | kfree(dev->targets); |