From nobody Thu Jun 27 16:24:57 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4W93nQ596Zz5Q089; Thu, 27 Jun 2024 16:24:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4W93nQ35rXz4QCn; Thu, 27 Jun 2024 16:24:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719505498; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rswVVqCbqaglMmTkUO68K/MEsXUFtfhg2LEqSywZ9Sk=; b=xouA8p+zrJ769SZu9q23kMDyDOAIQNaP31aHf2B/RHwDppfb6LzUgQEAZRCXTQMxXgw+6H zxE3iFSfpwh7Ay/NL73N8heE0zZM4Svz4nz3wSyxZOZA6ymzdIa0IwvwFhR0rAp6e21jUl mk/bnsanW2tnTJQ0605/qBVWNl8wGL5nX8tuEbhbR+Mrdspn5H+xj/DDGil8PMpFz/AbC0 o0DGAGRWdbFjwwiVpxuuzuev1CGR/1MD1IiG2cOeVyFNVAczVvuLO31eslTJ7pOaBN/Xjm E5rrEfkXRq2VjGZv+MxWLVAznqdR+6kkTAuDNXtbDw4RwbmumADwZK+HjNTfVA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719505498; a=rsa-sha256; cv=none; b=hSNwmtMicPin61srAdAVhti7sdTPcCyizZYYlK1ha+IEITT5qzpENmjEtz5cE5RnYrYtrC MrvyvbnWraEJ2WDySKHoU7/l4Kjx/u5NOe+L7Gqpchi5Uvd1WKa9Xiia1aYFAx+RPIERuS NwSp1150BxaICmrig9y0lMqZm/WEx8wdzBH0xN7Ghs+26FdZiIcRzLNHyBUa29rGH/sSen +8cyVgFhMWj8rRvjwtquQkm5bEKlp8qv1bFuetDtYEKRmdDx5S0fFbF3avpzIqKt7bn6sE M3vNGzbeQT1zaRgllQX77eS98fI0ca1i4UxEHEa40H2daTT7OXEBvwKoMSajZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719505498; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rswVVqCbqaglMmTkUO68K/MEsXUFtfhg2LEqSywZ9Sk=; b=sAmLdDoof9RvanEyUbYkHfhBkM5J1Mcus1K+Hzo8YAVUFoVVNdCUCOMHPsmUuxSw57nNWg HucGfruAfAmR1UuQy5yoKDK36sfVONuAsL0AugWQeJ3GNi1QiZIIbCBYvQlT+XTnb9klw8 45QxOsLx6/VhTyIgC3GRCBC/ykD7Rh/PMNeeXtM+TRvcS08T2UTd/92n1pkIc1//9q6r4C xAVH9Q1U96Bhpg7EayD33HGckBS+OfKDyg7cDfoUYKpMWroMJhmJlEGTa1kqmsCQcat0Mq hAnIP7d83XTdcPFeNYeoel/ph0phypKNBCp1Az1sBU3Y4n0RMo8h/AUGIKMKgA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4W93nQ0tWzzJrM; Thu, 27 Jun 2024 16:24:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45RGOvE2070194; Thu, 27 Jun 2024 16:24:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45RGOvp4070191; Thu, 27 Jun 2024 16:24:57 GMT (envelope-from git) Date: Thu, 27 Jun 2024 16:24:57 GMT Message-Id: <202406271624.45RGOvp4070191@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 3703e1a73e0e - main - tcp: improve error handling in syncache_socket() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3703e1a73e0e0367c04f47f793e46495e46e647b Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=3703e1a73e0e0367c04f47f793e46495e46e647b commit 3703e1a73e0e0367c04f47f793e46495e46e647b Author: Michael Tuexen AuthorDate: 2024-06-27 05:25:15 +0000 Commit: Michael Tuexen 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))) {