From nobody Sat Aug 03 22:50:06 2024 X-Original-To: dev-commits-src-all@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 4WbyZl0dNvz5RTmD; Sat, 03 Aug 2024 22:50:07 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WbyZk5Sctz4KTY; Sat, 3 Aug 2024 22:50:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722725406; 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=YGsoPWdhimxm2UKJsVvegJL094s+4mknsCjPfqblGs0=; b=RkH/yfuHdQit3gqeEY42XHyOKijiWk9G1RzdiDHfVgDSYjQmi+HD9dCehhomTZUJeGz3ey iQJ9B7+9kV3AduxRE0pCS3XmXLsegTVFr7NPSXx8oZdFRJ65wA6ZN5EALVXO5pGxCsc3hC 61n/shasvIfLARlicvi9ywyC0pVgaLGwDArfywkKUuwAkuz7CtSL1u/31/ciS2ptG78snL lX0OBnqWVslv6kX6f52Dd3NEUmtYhrJWim+fjmo15NHedXrDy3gOt6Reow+j7fWgGNlPvQ EDVgdz7PNOlFdiU6tM4TN4jtpS8qBcbd2WzyE51JGyrlK+W19M329TDpWXVdJA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722725406; a=rsa-sha256; cv=none; b=dZE2dBkcnSWSAz9Jslc7Y7xo7YzsPK/onHSkZC+pfcHgi78Crga7GkXmZD7ShQEx3r4A8N REr++2gkHo4cMjBIdN+VauAE8WYdVGZXlzGoiypWjA8+pQLGayd8yV/QezTcgWP9eugXqR rdnpUAKmMdmxNCau5SoYGkxVI834/P3uhQlL7RIub64i8JTMm6RL1R/RulmC8PFznSTzmR CUjP2Z973ZOIfUsuzPQkNtpwBKUn1VYXhBZZuFt8algNIegwf7IwroQLxPDASmMzEznp8J jqu4I/K+/QgT2EwkGDgbJIo9URtnomtRG+K0s98dKGS65e4ni8CQWwZUoBijQw== 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=1722725406; 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=YGsoPWdhimxm2UKJsVvegJL094s+4mknsCjPfqblGs0=; b=e9IcUhvDDT+kbJAgWKzBJLapn+QlVln0iunAfne4w651hiBVFb6sts8IPe4629GYx5ip5J +XmYoJDCS+s1DCHHSsXwjmkQa+5YWV9zC3nx9oZIyxH/435qcg/pm+S3ibnv36CM98Fslf A2A6shaoHuVJiazwtqYIXpTBdFYwwdBlEcW/D6qy703N7mtnq8g8gkDwQu2IXnc9pL3FGm kNK8uT0MCwH18Ae5Z38w5AGOEntG/5pvWcrkX/i4Xgzd6JofUxATM5yPkMfXSZAXTRcDji J+6sagyMyvRI9XLymyoom+KPw4KKsAsq8E25K7mX+EbVbxV1Z6B37/kPRCVZNQ== 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 4WbyZk43YFzWPV; Sat, 3 Aug 2024 22:50:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 473Mo6XB064061; Sat, 3 Aug 2024 22:50:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 473Mo6Oa064056; Sat, 3 Aug 2024 22:50:06 GMT (envelope-from git) Date: Sat, 3 Aug 2024 22:50:06 GMT Message-Id: <202408032250.473Mo6Oa064056@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 5632dd45cc10 - stable/14 - tcp: improve error handling in syncache_socket() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 5632dd45cc10ec75f9ba679b9b985c82b7a40267 Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=5632dd45cc10ec75f9ba679b9b985c82b7a40267 commit 5632dd45cc10ec75f9ba679b9b985c82b7a40267 Author: Michael Tuexen AuthorDate: 2024-06-27 05:25:15 +0000 Commit: Michael Tuexen CommitDate: 2024-08-03 22:49:33 +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 Differential Revision: https://reviews.freebsd.org/D45749 (cherry picked from commit 3703e1a73e0e0367c04f47f793e46495e46e647b) --- 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 20c77930556e..21dfe8dd123e 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1050,6 +1050,7 @@ allocfail: return (NULL); abort: + tcp_discardcb(tp); in_pcbfree(inp); sodealloc(so); if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {