NFC: fix resource leak when target index is invalid
authorPan Bian <bianpan2016@163.com>
Thu, 21 Jan 2021 15:27:48 +0000 (07:27 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Feb 2021 22:28:51 +0000 (23:28 +0100)
commite10a1aad5f7cc969a78424c8b28cafdbb9299c8f
treeb8daa58cb91ad34e19b37ef439823a30ab308f46
parent2e83a57a23a6c08308baebec660d1fdd82b3a4ea
NFC: fix resource leak when target index is invalid

commit 3a30537cee233fb7da302491b28c832247d89bbe upstream.

Goto to the label put_dev instead of the label error to fix potential
resource leak on path that the target index is invalid.

Fixes: c4fbb6515a4d ("NFC: The core part should generate the target index")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Link: https://lore.kernel.org/r/20210121152748.98409-1-bianpan2016@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/nfc/rawsock.c