* [PATCH] chtls: Fix potential resource leak
@ 2021-01-21 14:57 Pan Bian
2021-01-23 21:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2021-01-21 14:57 UTC (permalink / raw)
To: Ayush Sawal, Vinay Kumar Yadav, Rohit Maheshwari, Jakub Kicinski
Cc: David S. Miller, netdev, linux-kernel, Pan Bian
The dst entry should be released if no neighbour is found. Goto label
free_dst to fix the issue. Besides, the check of ndev against NULL is
redundant.
Signed-off-by: Pan Bian <bianpan2016@163.com>
---
.../net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
index e5cfbe196ba6..19dc7dc054a2 100644
--- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
+++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
@@ -1158,11 +1158,9 @@ static struct sock *chtls_recv_sock(struct sock *lsk,
#endif
}
if (!n || !n->dev)
- goto free_sk;
+ goto free_dst;
ndev = n->dev;
- if (!ndev)
- goto free_dst;
if (is_vlan_dev(ndev))
ndev = vlan_dev_real_dev(ndev);
@@ -1250,7 +1248,8 @@ static struct sock *chtls_recv_sock(struct sock *lsk,
free_csk:
chtls_sock_release(&csk->kref);
free_dst:
- neigh_release(n);
+ if (n)
+ neigh_release(n);
dst_release(dst);
free_sk:
inet_csk_prepare_forced_close(newsk);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] chtls: Fix potential resource leak
2021-01-21 14:57 [PATCH] chtls: Fix potential resource leak Pan Bian
@ 2021-01-23 21:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-01-23 21:30 UTC (permalink / raw)
To: Pan Bian
Cc: ayush.sawal, vinay.yadav, rohitm, kuba, davem, netdev, linux-kernel
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Thu, 21 Jan 2021 06:57:38 -0800 you wrote:
> The dst entry should be released if no neighbour is found. Goto label
> free_dst to fix the issue. Besides, the check of ndev against NULL is
> redundant.
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
> .../net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
Here is the summary with links:
- chtls: Fix potential resource leak
https://git.kernel.org/netdev/net/c/b6011966ac6f
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:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 14:57 [PATCH] chtls: Fix potential resource leak Pan Bian
2021-01-23 21:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).