From nobody Sat Aug 03 22:50:49 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 4WbybY1ghJz5RTxh; Sat, 03 Aug 2024 22:50:49 +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 4WbybY1CJFz4KvS; Sat, 3 Aug 2024 22:50:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722725449; 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=yxTrU+jkr3zp7dknNBEAsMMvna86MLO2Pm7lJ26xQwk=; b=BBN3MS3hOHnlM0ygx0fGL/KCagueMbWOCAFsNHTOx7RTyfCO1YEUDoxA2JxyLh/vvVVOR+ hEf8egzLeJcnNiGfq+KP86K6e3DIrbKWAmVy6ViApjqiAwam+Sl5jEAMi4eZ/F6W2qhWku J5bRHSuQsY5MxZPHnM2w8SoPKRdFjrXhdg/LuEG5d8PT5kArDyP78O6fd1R0h0gYcv8GH3 fgqWFUdkI68jmZUEKQFGKJG+8jJGqHFEtMZMZj8mPWY3O4DPuOtCd5OZmiVoItrfN22Iju FC/X/XZwSxv3i/aKWikQlp8h64/tI9nGnf7JFxUG+83J69KO6T9UUs75Qmmx+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722725449; a=rsa-sha256; cv=none; b=ytrWa6XDD2J2c1j1r0sA7lFksAx48nEgaSBAER1ZXnSSdLN6q0k7VM65Kplj4rGSdl63Dq kWMFf0E2CYnnMzM1Xk/WhhvyHnoJFkJzszZtDiA9r4oXjt246qsv8KFQE1ZDVQDGVGw+26 au2J6fyF7AADCdCA6+bJpE5pA9aZisVPag9EgUGlmbhuji/80f/GJxTOvKtsh7E9gOU6fB wiyHCe6ZOMNkZlJeUFmXazPiFhPU63uMG0vPyp0T/rZDq37TmwiXFzX5vDL9i0cfelc0o0 2MCTN3yMf17VcRqEG9DgOdNGo3aTwsmD9AsmNt2JZqsxiNb0B9nq+yaguNG8iw== 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=1722725449; 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=yxTrU+jkr3zp7dknNBEAsMMvna86MLO2Pm7lJ26xQwk=; b=S9YtmS8dfbSXpxM5G1okggCdTKQ3udUxAtcnOkTtBb3l+AFdRcfC4FMriFTdHHF4gXFWNv VNqxT7ALIDDIoHCXcKekA1zIQk78Y7esLeAjydfWOjUA1Upod1svlB/2GG45Z3n68UsSNZ V1d2HoCA1QYwJe+Uhz5b8MwohtrsB4JmWm8SV/rKEWldR84BNhLzIaftm3GnyJ0a47qYsx bTawWwsNyra+UTzCwzANkB9XApsMnwe7zWF9l2B9qM6bjG0Ijw++BSE0zcbzv3MlawJcS7 a9rJowuLerWVtZ8Z3nnCFlJ4C7FO2Ax6X5OMadG0N/aCqebUwZ67XG3oVVmW1A== 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 4WbybY0qKyzWM5; Sat, 3 Aug 2024 22:50:49 +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 473MonLq072132; Sat, 3 Aug 2024 22:50:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 473MonQo072129; Sat, 3 Aug 2024 22:50:49 GMT (envelope-from git) Date: Sat, 3 Aug 2024 22:50:49 GMT Message-Id: <202408032250.473MonQo072129@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: d02a9ef1f03a - stable/14 - tcp: improve failure handling in tcp_newtcpcb() 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: d02a9ef1f03aaa5fd6cc7c27ba1facdf997f0a67 Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=d02a9ef1f03aaa5fd6cc7c27ba1facdf997f0a67 commit d02a9ef1f03aaa5fd6cc7c27ba1facdf997f0a67 Author: Michael Tuexen AuthorDate: 2024-06-27 06:26:34 +0000 Commit: Michael Tuexen CommitDate: 2024-08-03 22:50:22 +0000 tcp: improve failure handling in tcp_newtcpcb() In case of a failure of tcp_newtcpcb, where NULL is returned, * call CC_ALGO(tp)->cb_destroy, after CC_ALGO(tp)->cb_init was called. * call khelp_destroy_osd(), after khelp_init_osd() was called. Reviewed by: glebius, rscheff Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D45753 (cherry picked from commit 14fee5324a9b76fff6e8aad266600eefab3ef335) --- sys/netinet/tcp_subr.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index afa2dc2a3a95..8785963cc7d0 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -2256,6 +2256,10 @@ tcp_newtcpcb(struct inpcb *inp) #ifdef TCP_HHOOK if (khelp_init_osd(HELPER_CLASS_TCP, &tp->t_osd)) { + if (CC_ALGO(tp)->cb_destroy != NULL) + CC_ALGO(tp)->cb_destroy(&tp->t_ccv); + CC_DATA(tp) = NULL; + cc_detach(tp); if (tp->t_fb->tfb_tcp_fb_fini) (*tp->t_fb->tfb_tcp_fb_fini)(tp, 1); refcount_release(&tp->t_fb->tfb_refcnt); @@ -2332,6 +2336,13 @@ tcp_newtcpcb(struct inpcb *inp) tp->t_pacing_rate = -1; if (tp->t_fb->tfb_tcp_fb_init) { if ((*tp->t_fb->tfb_tcp_fb_init)(tp, &tp->t_fb_ptr)) { + if (CC_ALGO(tp)->cb_destroy != NULL) + CC_ALGO(tp)->cb_destroy(&tp->t_ccv); + CC_DATA(tp) = NULL; + cc_detach(tp); +#ifdef TCP_HHOOK + khelp_destroy_osd(&tp->t_osd); +#endif refcount_release(&tp->t_fb->tfb_refcnt); return (NULL); }