Skip to content

Commit 2f21f06

Browse files
Ziyang Xuangregkh
authored andcommitted
nfc: fix error handling of nfc_proto_register()
commit 0911ab3 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: c7fe3b5 ("NFC: add NFC socket family") Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Link: https://lore.kernel.org/r/20211013034932.2833737-1-william.xuanziyang@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ba39f55 commit 2f21f06

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎net/nfc/af_nfc.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ int nfc_proto_register(const struct nfc_protocol *nfc_proto)
6060
proto_tab[nfc_proto->id] = nfc_proto;
6161
write_unlock(&proto_tab_lock);
6262

63+
if (rc)
64+
proto_unregister(nfc_proto->proto);
65+
6366
return rc;
6467
}
6568
EXPORT_SYMBOL(nfc_proto_register);

0 commit comments

Comments
 (0)