From patchwork Fri Jul 6 20:09:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Ortiz X-Patchwork-Id: 1167471 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A94FB40135 for ; Fri, 6 Jul 2012 20:14:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757281Ab2GFUAY (ORCPT ); Fri, 6 Jul 2012 16:00:24 -0400 Received: from mga14.intel.com ([143.182.124.37]:2576 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751108Ab2GFUAW (ORCPT ); Fri, 6 Jul 2012 16:00:22 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 06 Jul 2012 13:00:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.71,315,1320652800"; d="scan'208";a="164934670" Received: from unknown (HELO sortiz-mobl) ([10.252.120.212]) by azsmga001.ch.intel.com with ESMTP; 06 Jul 2012 13:00:19 -0700 From: Samuel Ortiz To: "John W. Linville" Cc: Lauro Ramos Venancio , Aloisio Almeida Jr , Ilan Elias , linux-wireless@vger.kernel.org, linux-nfc@lists.01.org, Samuel Ortiz Subject: [PATCH 28/33] NFC: Do not return EBUSY when stopping a poll that's already stopped Date: Fri, 6 Jul 2012 22:09:48 +0200 Message-Id: <1341605393-32056-29-git-send-email-sameo@linux.intel.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1341605393-32056-1-git-send-email-sameo@linux.intel.com> References: <1341605393-32056-1-git-send-email-sameo@linux.intel.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org We check for the polling flag before checking if the netlink PID caller match. Signed-off-by: Samuel Ortiz --- net/nfc/netlink.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index 03c31db..99bc6f7 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) {