Commit 8668fdd6efb3a75e0d58a3287a47fa7e60a68a73
Committed by
John W. Linville
1 parent
a070c8591a
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 7 additions and 2 deletions Side-by-side Diff
net/nfc/core.c
... | ... | @@ -571,12 +571,17 @@ |
571 | 571 | |
572 | 572 | pr_debug("dev_name=%s n_targets=%d\n", dev_name(&dev->dev), n_targets); |
573 | 573 | |
574 | - dev->polling = false; | |
575 | - | |
576 | 574 | for (i = 0; i < n_targets; i++) |
577 | 575 | targets[i].idx = dev->target_next_idx++; |
578 | 576 | |
579 | 577 | device_lock(&dev->dev); |
578 | + | |
579 | + if (dev->polling == false) { | |
580 | + device_unlock(&dev->dev); | |
581 | + return 0; | |
582 | + } | |
583 | + | |
584 | + dev->polling = false; | |
580 | 585 | |
581 | 586 | dev->targets_generation++; |
582 | 587 |