git: 3703e1a73e0e - main - tcp: improve error handling in syncache_socket()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 27 Jun 2024 16:24:57 UTC
The branch main has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=3703e1a73e0e0367c04f47f793e46495e46e647b
commit 3703e1a73e0e0367c04f47f793e46495e46e647b
Author: Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-06-27 05:25:15 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-06-27 05:25:15 +0000
tcp: improve error handling in syncache_socket()
If syncache_socket() fails after calling tcp_newtcpcb(), the resources
allocated in tcp_newtcpcb() needs to be freed. Just call
tcp_discardcb() to do this.
Thanks to jtl for making me aware of the issue and proposing a fix.
Reviewed by: glebius, jtl, rscheff
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D45749
---
sys/netinet/tcp_syncache.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index c21dbbb58e31..1a3b6ebf6788 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -1053,6 +1053,7 @@ allocfail:
return (NULL);
abort:
+ tcp_discardcb(tp);
in_pcbfree(inp);
sodealloc(so);
if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {