From: Samuel Ortiz <sameo@linux.intel.com> Date: Thu, 28 Jun 2012 14:41:57 +0000 (+0200) Subject: NFC: Do not return EBUSY when stopping a poll that's already stopped X-Git-Tag: firefly_0821_release~3680^2~2381^2~57^2~130 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a831b9132065e1aa18acd7910d5f9c164a2f350f;p=firefly-linux-kernel-4.4.55.git 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> --- 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) if (!dev) return -ENODEV; + device_lock(&dev->dev); + + if (!dev->polling) { + device_unlock(&dev->dev); + return -EINVAL; + } + + device_unlock(&dev->dev); + mutex_lock(&dev->genl_data.genl_data_mutex); if (dev->genl_data.poll_req_pid != info->snd_pid) {