This is a note to let you know that I've just added the patch titled nfc: fix error handling of nfc_proto_register() to the 5.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: nfc-fix-error-handling-of-nfc_proto_register.patch and it can be found in the queue-5.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 0911ab31896f0e908540746414a77dd63912748d Mon Sep 17 00:00:00 2001 From: Ziyang Xuan <william.xuanziyang@xxxxxxxxxx> Date: Wed, 13 Oct 2021 11:49:32 +0800 Subject: nfc: fix error handling of nfc_proto_register() From: Ziyang Xuan <william.xuanziyang@xxxxxxxxxx> 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@xxxxxxxxxx> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20211013034932.2833737-1-william.xuanziyang@xxxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- 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); Patches currently in stable-queue which might be from william.xuanziyang@xxxxxxxxxx are queue-5.14/nfc-digital-fix-possible-memory-leak-in-digital_tg_listen_mdaa.patch queue-5.14/nfc-fix-error-handling-of-nfc_proto_register.patch queue-5.14/nfc-digital-fix-possible-memory-leak-in-digital_in_send_sdd_req.patch