[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211025190936.640544328@linuxfoundation.org>
Date: Mon, 25 Oct 2021 21:14:06 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
Ziyang Xuan <william.xuanziyang@...wei.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH 4.9 19/50] nfc: fix error handling of nfc_proto_register()
From: Ziyang Xuan <william.xuanziyang@...wei.com>
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 <william.xuanziyang@...wei.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
Link: https://lore.kernel.org/r/20211013034932.2833737-1-william.xuanziyang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
net/nfc/af_nfc.c | 3 +++
1 file changed, 3 insertions(+)
--- a/net/nfc/af_nfc.c
+++ b/net/nfc/af_nfc.c
@@ -72,6 +72,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);
Powered by blists - more mailing lists