Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3032716pxb; Mon, 18 Oct 2021 07:00:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHTwTATw5wdd4YHFJBcxaFR9KuYvXVmlCBn8Ft0oiN1ajvMsavFhZn2HEwL4R6dBwHT+P5 X-Received: by 2002:a17:90a:b901:: with SMTP id p1mr47807102pjr.111.1634565623064; Mon, 18 Oct 2021 07:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634565623; cv=none; d=google.com; s=arc-20160816; b=0b7cDd1ScFBr+BNOVTI3cVFsmONQA+gO2vCI9voaVS+40+k77Q3q3y7KbIVKUhtfQX fiEhv1iRfsxZc2YPkVutfLzSBzjGIkO/Yu42CzRR4JT1CO/VpBgu9wnSfBYr/Y/z1OEw Ur3dwNqOAy9s7QLgW4IcbiMykT3pegvMSBHZ4KVZvBkzbTuAT5+cxB1sKOlVy+ob5cXw 6dEh1TyaN5pKPTzuoiwUayOarbZ2Bi2Ef7XVk0xKIFCsXtLcRLkOqaeqEeE0nPD8YZM7 cCvkMScxNzwBqqxu3+lB5w6SejClFAcGXsDU4jpqCSfzArgORA8356yA1R9lK6EROo0C moyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JJ5ZmU1tFJbHrv00MbradcIO7u9Ut6aU6OlsBbrAZr8=; b=JWLMTAYwz7pIoXeJE9/rDpunV2E9diHPZAulDOWTmdw5qOq7O05wubCUvkQMwuK2Bv e3yGgU1mEhI5NZ3mOiD7TRPolnTAlEr7+AV0/uMHuKv1IpYE/I0tFSLix+lVVCWsmPVE ek41ODtOoqsMWibyqF+qQlvkqb597Cday4wRe0BFea09W3SGOSRtYEcWRqC2N2CktOZ8 Xg3xWVVk4T3f5ITobr5U+qmGZnRzVxtCnD1pCzpMrXF1m718p+RhoxINe+mmg1TiseJ/ b38Yjrzzp1Q7TLc0fgz3mhiBYNJgUYI/kY0+BnmbaEMB8BoXzj5s8GPqXphvIV6wNCFo TVsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kTqavzVu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si24786949plh.349.2021.10.18.07.00.10; Mon, 18 Oct 2021 07:00:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kTqavzVu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231847AbhJROBX (ORCPT + 99 others); Mon, 18 Oct 2021 10:01:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:39660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233977AbhJRN7T (ORCPT ); Mon, 18 Oct 2021 09:59:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 543F161A3B; Mon, 18 Oct 2021 13:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564504; bh=czaI13gQk7wRy9J0Hi5zKCZKM6yOkAkNqxw0VBmSeSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kTqavzVuy0paiTpIer2iajZuN85A/qniLrRDAleqfkFADrSrh9fJqx+WW8dtO6L9X /fyiuZviRTxy3i7Xn+zsGug1apOOEBXfwFbuKVAN/ztbELKMIWBgj7SG+FdXiq6hpT ydiKWLq9KW3XcwkrcXeM78kXMCWbhRhqj+L/uamo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ziyang Xuan , Krzysztof Kozlowski , Jakub Kicinski Subject: [PATCH 5.14 115/151] nfc: fix error handling of nfc_proto_register() Date: Mon, 18 Oct 2021 15:24:54 +0200 Message-Id: <20211018132344.415673589@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132340.682786018@linuxfoundation.org> References: <20211018132340.682786018@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ziyang Xuan commit 0911ab31896f0e908540746414a77dd63912748d upstream. When nfc proto id is using, nfc_proto_register() return -EBUSY error code, but forgot to unregister proto. Fix it by adding proto_unregister() in the error handling case. Fixes: c7fe3b52c128 ("NFC: add NFC socket family") Signed-off-by: Ziyang Xuan Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20211013034932.2833737-1-william.xuanziyang@huawei.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/nfc/af_nfc.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/nfc/af_nfc.c +++ b/net/nfc/af_nfc.c @@ -60,6 +60,9 @@ int nfc_proto_register(const struct nfc_ proto_tab[nfc_proto->id] = nfc_proto; write_unlock(&proto_tab_lock); + if (rc) + proto_unregister(nfc_proto->proto); + return rc; } EXPORT_SYMBOL(nfc_proto_register);