Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp544152ybx; Wed, 6 Nov 2019 22:34:39 -0800 (PST) X-Google-Smtp-Source: APXvYqyKe6Uq13NUk2pe9h1BcUf4e2sSQHz7D8u6fkq/7mOaUjVtyOWsj9H0uAxlH2Pab5Y8DSsd X-Received: by 2002:a17:906:f42:: with SMTP id h2mr1468507ejj.39.1573108479618; Wed, 06 Nov 2019 22:34:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573108479; cv=none; d=google.com; s=arc-20160816; b=GoKlSmsax/MroEuj1M8Dz4ozi8dkMN4xKKhRbRaAjbLaJWLf5h9eyrxoq4dLgXjpAn rqq/99T8/TIQoa/VUJ2NqM5b5Li+NF4F45FWet/DcJxQz8fJ60v7C5CuOQYtB17+XyiT z5isWQUE0hf6ciXEklEDJxFzrjdbzmwyYlMS03dvQnDziQx593A5TuEeVw5qNNbHVB+Q 8i/4+J3dx5hgE0BwU4iTvJdndAV1Cf3eG2B/BqtifkJLT5fGZkrtxAH1Fo/knIXMSQpW HXqDA11W5K5y3bc9MofoAuqicdpeWMqfGmptkjHkJT3V6fwttlhpETcsZMM4JWBe5Rsl 1vFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=v/B2ToBpKvai59daRLvVEWSvI0l4Py53TzTQJCqwvY4=; b=fLpSD4fgHKLEC6D3W/mZ3S9+a5jFAKrzvcS1pYsoh5Rs1t2WMLTE/O3N6ljY20MiVq 21K1xUomvOyDHnYoMHBKkvs3AxRERq7rj1z55vG9icG0/3mrCM7wY9x/q8a9YV1EG4gf GcFegXAu6pZe6YywHHXDsT5F+/Gvo3KcmHba+LhC1RyVw2l+7Y5/+1+HKk7wBvznpHYO ChonLI5g7jT44C80cC63uhaSc4wGcBGKLBxtOjUvgne7TGH1F0irTzKCGt5GurjV1r5B 9ZVUh7f0wYuaZVmmcQ88uovYUkC3v1TF+0+/Az+ZqBwIrAdXAWaL0qaCI6Cj3Z/j4aVW skew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=ZyzDE7CM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i39si867376eda.88.2019.11.06.22.34.16; Wed, 06 Nov 2019 22:34:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=ZyzDE7CM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726823AbfKGGah (ORCPT + 99 others); Thu, 7 Nov 2019 01:30:37 -0500 Received: from mail-m974.mail.163.com ([123.126.97.4]:55064 "EHLO mail-m974.mail.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725938AbfKGGah (ORCPT ); Thu, 7 Nov 2019 01:30:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=v/B2ToBpKvai59daRL vVEWSvI0l4Py53TzTQJCqwvY4=; b=ZyzDE7CMx/26AcilhkRkb8FnIdJj+f91rb 3M7lm5tp2CIoMVz/mzhBkKdupchxo6bfGb7RxmjMNZasOQ/7WnxK9USR6h41npcj WsiqUbipL/DAZvskwmA4MCAbQDHiHnDUVY8sksgthZlFoqsdNcB952vNOLTaIWHo IiJO7+SW0= Received: from localhost.localdomain (unknown [202.112.113.212]) by smtp4 (Coremail) with SMTP id HNxpCgD3dtviucNdteMLBg--.305S3; Thu, 07 Nov 2019 14:30:03 +0800 (CST) From: Pan Bian To: "David S. Miller" , Johannes Berg , Steve Winslow , Young Xiao <92siuyang@gmail.com>, Allison Randal , Michal Kubecek , Andrey Konovalov , Thomas Gleixner Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH v2] nfc: netlink: fix double device reference drop Date: Thu, 7 Nov 2019 14:29:50 +0800 Message-Id: <1573108190-30836-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: HNxpCgD3dtviucNdteMLBg--.305S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrKw17Zr1xuF47JF4UtF18Zrb_yoWfXFcEy3 4rtr4UWrn8X3s3Ja12kw4UAF9FywnFqr4xCF4SkrWxZa45Zan8uw4kZ39xAry7uw43AFWj q3WkJrW8t347XjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUbEoGJUUUUU== X-Originating-IP: [202.112.113.212] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/xtbBZAtmclQHHg832AAAsW Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function nfc_put_device(dev) is called twice to drop the reference to dev when there is no associated local llcp. Remove one of them to fix the bug. Signed-off-by: Pan Bian --- v2: change subject of the patch --- net/nfc/netlink.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index 17e6ca62f1be..afde0d763039 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c @@ -1099,7 +1099,6 @@ static int nfc_genl_llc_set_params(struct sk_buff *skb, struct genl_info *info) local = nfc_llcp_find_local(dev); if (!local) { - nfc_put_device(dev); rc = -ENODEV; goto exit; } @@ -1159,7 +1158,6 @@ static int nfc_genl_llc_sdreq(struct sk_buff *skb, struct genl_info *info) local = nfc_llcp_find_local(dev); if (!local) { - nfc_put_device(dev); rc = -ENODEV; goto exit; } -- 2.7.4