nfc: Fix potential resource leaks
authorMiaoqian Lin <linmq006@gmail.com>
Fri, 23 Dec 2022 07:37:18 +0000 (11:37 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 11:02:03 +0000 (12:02 +0100)
commitb32f6bef248562bb5191ada527717ea50b319466
treef2d94aa86820c98582d97d6b6d3e2106779ba444
parentbb50c43f7789a1158263ee02b2f50cf341e32578
nfc: Fix potential resource leaks

[ Upstream commit df49908f3c52d211aea5e2a14a93bbe67a2cb3af ]

nfc_get_device() take reference for the device, add missing
nfc_put_device() to release it when not need anymore.
Also fix the style warnning by use error EOPNOTSUPP instead of
ENOTSUPP.

Fixes: 5ce3f32b5264 ("NFC: netlink: SE API implementation")
Fixes: 29e76924cf08 ("nfc: netlink: Add capability to reply to vendor_cmd with data")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/nfc/netlink.c