Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6569634ybx; Mon, 11 Nov 2019 11:06:51 -0800 (PST) X-Google-Smtp-Source: APXvYqynRT1/vq+NZSpJOdT23XsEErPD+tWZs0mNlaak5a+g1lzZUl36x1JXOzah0ZroizlP6YxC X-Received: by 2002:a17:906:53cc:: with SMTP id p12mr24325693ejo.52.1573499211536; Mon, 11 Nov 2019 11:06:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573499211; cv=none; d=google.com; s=arc-20160816; b=GL166g7QnaITGnoESStiao0h7xoTkcIyvBS3e4ECYECsfdya5EIsp84tsq7GghROPw OymUlIBWOtPLSyedL95qUpzbQtzKZlZlnxHjNnLdSU0n3Jg1eZMtR4K5UmWN3quCVniE uKdlpqlRS0lZcemcuR8a9gM/8O1AxbYgJnJbITbmMQmGtic4fFGfmDyjJGSnjummyu3j eH4GITcH34CYXBMnJwtEaTp2I6Tt0xlgZXtmeZyXLjYs/3WQBkis3hiazfmuxcFXpZZV sB+lp/SuWN65KfXpK2wSJ+0GSvfFQpBAza0LKtvMb2OA5R0Ccb3Rz8/ns6Ux25gBeCtS Zxow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6Emivv3e+D9d+/gzXujeOL+CxkYMQwQ7siusZG8A+58=; b=1FsHlDkP5wHAotqaR3+GVLRwF49+4UN4JMk5dTc7DKR+qB/c5xXFJtW1amKIJutkBN vsc9pWNI3J6l8dpfNtXhICp7m2YF7i0rQGO7Cf2HnrS5ip/rqWKG4p45bY6WnMTR1g3V GT3fjAnrhsuouTuZyhhWE1kNcWmBh8ZpPGe0i0bTUKR51bGdfxUmy0GTukbjh/dfzFYy +53AmK8wYjqyUvpNygvqYEwN/nXqIXxTXUqCWrJ2lpqIziUUCD0vB5Fg7wVlSQo4Lr2I f6x6ZFVmaPL4iDauYszs9bv3kmR8S3KmBwbS1w89ZGN5Ed/DQmO3PIkDrN06SNkBPpgb Qo7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hbCfvEQu; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14si12430208edl.128.2019.11.11.11.06.27; Mon, 11 Nov 2019 11:06:51 -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=@kernel.org header.s=default header.b=hbCfvEQu; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728124AbfKKSmT (ORCPT + 99 others); Mon, 11 Nov 2019 13:42:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:33426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729493AbfKKSmP (ORCPT ); Mon, 11 Nov 2019 13:42:15 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 48AAC20674; Mon, 11 Nov 2019 18:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573497733; bh=4nd80/nEjMUO2m1JwBIUNTi7+77i17sFMX/JwlOFRQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hbCfvEQu2x8wJkamvtpNaG0575/8mcdWuui6mwRZrs+HvzuW0rZUbvaVwP99VPpr4 4m0ISxLT+zq61gJ0AaKcA7qPwvQ4VUSlQ5PReEQ3LOxREGc77PEwQKfsBhlQcMxUFG Lj9yT5t0RcHR73NmXijCOFuMwreo0GOrjhwH7QZk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , Johan Hovold , "David S. Miller" Subject: [PATCH 4.19 009/125] nfc: netlink: fix double device reference drop Date: Mon, 11 Nov 2019 19:27:28 +0100 Message-Id: <20191111181440.716820399@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111181438.945353076@linuxfoundation.org> References: <20191111181438.945353076@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pan Bian [ Upstream commit 025ec40b81d785a98f76b8bdb509ac10773b4f12 ] 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. Fixes: 52feb444a903 ("NFC: Extend netlink interface for LTO, RW, and MIUX parameters support") Fixes: d9b8d8e19b07 ("NFC: llcp: Service Name Lookup netlink interface") Signed-off-by: Pan Bian Reviewed-by: Johan Hovold Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/nfc/netlink.c | 2 -- 1 file changed, 2 deletions(-) --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c @@ -1110,7 +1110,6 @@ static int nfc_genl_llc_set_params(struc local = nfc_llcp_find_local(dev); if (!local) { - nfc_put_device(dev); rc = -ENODEV; goto exit; } @@ -1170,7 +1169,6 @@ static int nfc_genl_llc_sdreq(struct sk_ local = nfc_llcp_find_local(dev); if (!local) { - nfc_put_device(dev); rc = -ENODEV; goto exit; }