aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-06-28 10:41:57 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-07-09 16:42:21 -0400
commita831b9132065e1aa18acd7910d5f9c164a2f350f (patch)
tree9cbaf7e194641e24e8e2f95e5d6f14cce9b7ff88 /net/nfc
parent1550bf2d59a5ab74c5c14f2e65ed83516ca7d74d (diff)
NFC: Do not return EBUSY when stopping a poll that's already stopped
We check for the polling flag before checking if the netlink PID caller match. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/netlink.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index 03c31db38f12..99bc6f7faa7b 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -634,6 +634,15 @@ static int nfc_genl_stop_poll(struct sk_buff *skb, struct genl_info *info)
634 if (!dev) 634 if (!dev)
635 return -ENODEV; 635 return -ENODEV;
636 636
637 device_lock(&dev->dev);
638
639 if (!dev->polling) {
640 device_unlock(&dev->dev);
641 return -EINVAL;
642 }
643
644 device_unlock(&dev->dev);
645
637 mutex_lock(&dev->genl_data.genl_data_mutex); 646 mutex_lock(&dev->genl_data.genl_data_mutex);
638 647
639 if (dev->genl_data.poll_req_pid != info->snd_pid) { 648 if (dev->genl_data.poll_req_pid != info->snd_pid) {