Skip to content

Commit e10a1aa

Browse files
SinkFindergregkh
authored andcommitted
NFC: fix resource leak when target index is invalid
commit 3a30537 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: c4fbb65 ("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>
1 parent 2e83a57 commit e10a1aa

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/nfc/rawsock.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static int rawsock_connect(struct socket *sock, struct sockaddr *_addr,
105105
if (addr->target_idx > dev->target_next_idx - 1 ||
106106
addr->target_idx < dev->target_next_idx - dev->n_targets) {
107107
rc = -EINVAL;
108-
goto error;
108+
goto put_dev;
109109
}
110110

111111
rc = nfc_activate_target(dev, addr->target_idx, addr->nfc_protocol);

0 commit comments

Comments
 (0)