All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFC: fix resource leak when target index is invalid
@ 2021-01-21 15:27 Pan Bian
  2021-01-23 21:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2021-01-21 15:27 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Marc Kleine-Budde, Qingyu Li,
	Samuel Ortiz, John W. Linville
  Cc: netdev, linux-kernel, Pan Bian

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>
---
 net/nfc/rawsock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c
index 955c195ae14b..9c7eb8455ba8 100644
--- a/net/nfc/rawsock.c
+++ b/net/nfc/rawsock.c
@@ -105,7 +105,7 @@ static int rawsock_connect(struct socket *sock, struct sockaddr *_addr,
 	if (addr->target_idx > dev->target_next_idx - 1 ||
 	    addr->target_idx < dev->target_next_idx - dev->n_targets) {
 		rc = -EINVAL;
-		goto error;
+		goto put_dev;
 	}
 
 	rc = nfc_activate_target(dev, addr->target_idx, addr->nfc_protocol);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] NFC: fix resource leak when target index is invalid
  2021-01-21 15:27 [PATCH] NFC: fix resource leak when target index is invalid Pan Bian
@ 2021-01-23 21:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-01-23 21:40 UTC (permalink / raw)
  To: Pan Bian
  Cc: davem, kuba, mkl, ieatmuttonchuan, sameo, linville, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Thu, 21 Jan 2021 07:27:48 -0800 you wrote:
> 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>
> ---
>  net/nfc/rawsock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - NFC: fix resource leak when target index is invalid
    https://git.kernel.org/netdev/net/c/3a30537cee23

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-23 21:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 15:27 [PATCH] NFC: fix resource leak when target index is invalid Pan Bian
2021-01-23 21:40 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.