Skip to content

Commit

Permalink
NFC: Core must test the device polling state inside the device lock
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Lapuyade authored and John W. Linville committed Jul 9, 2012
1 parent a070c85 commit 8668fdd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions net/nfc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,13 +571,18 @@ int nfc_targets_found(struct nfc_dev *dev,

pr_debug("dev_name=%s n_targets=%d\n", dev_name(&dev->dev), n_targets);

dev->polling = false;

for (i = 0; i < n_targets; i++)
targets[i].idx = dev->target_next_idx++;

device_lock(&dev->dev);

if (dev->polling == false) {
device_unlock(&dev->dev);
return 0;
}

dev->polling = false;

dev->targets_generation++;

kfree(dev->targets);
Expand Down

0 comments on commit 8668fdd

Please sign in to comment.