From nobody Sun May 5 06:40:16 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 4VXFKD59PQz5JBK9; Sun, 05 May 2024 06:40:16 +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 4VXFKD4TZmz3ypH; Sun, 5 May 2024 06:40:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714891216; 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=Fw0atGa0Dcz4k4Iv+ow2X4+D0ZaKbZQomjiue1potvo=; b=ylfRwQkFmneKZRa+evrap5/big3G5LIlsOPBpD7PNVezyMY4xI8Z5OwfAGvJeRm1h/zH8v hgqrF9BSJnWe7BgIuUvQFtiWN7MHPxLtFkAnsHDfQtcv9dNOzdg4Y42ckSkZIXhh1DkAAR Kg9S+7KrYoVwyGpojWQ1Tz0XNV3x7MN7yfiIJGrWbT4f0XZnRHVbahyTfWXKKb6ZKCc/AQ pBvcO6DXN4hRaPuUEnu7itm+T+IIIzaxPLmdNxApbBtixpQ0875w9+dI22d1TeAuOoZ5WT NRWIOcihph41l+d4toJQJvm9ZfM3A/y+GwdKFb7V2La4HnqEDv09hPbIAgUJpQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714891216; a=rsa-sha256; cv=none; b=jTuow778jXMrOr7/53SHIrffBaipn++8YE+5fthgFB0VbeuBBQLMGB917N0VjHZd00aPxN Yc4gfXey/7PWIuIvYGIasrrMjRalyGcameX9aEtxqqPQBZdk1O0IY4CIH+ZniBLPscgVaE PWk38gSVLrdjhEh2zqoMw0EVHBOPOzmf2n28C1AYXq31dELPtgZAnkKnEX0n+z7UV5CClv DRnL7mTuLyXGNGgM+YW5ppsZjF5xDL6bNPCwwzbgmwXoxjqgDQviB/AnxfxIsa0mQyqf4Z e2rQyPaX7qBynNBpPd8d6pXz/xiB17kM7g5PLTPd/eB7iqjNFWVTC03CtaQfVw== 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=1714891216; 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=Fw0atGa0Dcz4k4Iv+ow2X4+D0ZaKbZQomjiue1potvo=; b=LNIoBpMuewfeBF5Oq+e26Inyqciwa4+YC3SRoLqRd943Ro7QohhGkkOFdv3Rkqzit/RNov yQQGqxBGc38xDE2RcBF2vgOygyHtMN/+iRCTqXEZvcur7kK2vsb/ILtd/jMFyBve8z7JwO Sz4bSMxrhc8r00xDlKchC9NiSVkxuipoJ2yHKKgb+bjlx6CbK8j8h2Cb9R5SuRJ4Mnn/tj zTWfLn2lxKf8MeRodKOsPF8Nn8M41kOtSmBVwFbPo/LIxpZKWcEET3OoC//UOSSwShy9z3 8x7Gpl5VN77pyrBol6zCCaMMgUR3VIbrRNagrs0x1xPQcVBjqcMD5MNQITZpmA== 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 4VXFKD3yYdz137D; Sun, 5 May 2024 06:40:16 +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 4456eGC1009969; Sun, 5 May 2024 06:40:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4456eGR0009960; Sun, 5 May 2024 06:40:16 GMT (envelope-from git) Date: Sun, 5 May 2024 06:40:16 GMT Message-Id: <202405050640.4456eGR0009960@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: b7e312c5abad - stable/14 - in_pcb: don't leak credential refcounts on error 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: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b7e312c5abad2fbae469f434cc0c36257c6bb3b8 Auto-Submitted: auto-generated The branch stable/14 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=b7e312c5abad2fbae469f434cc0c36257c6bb3b8 commit b7e312c5abad2fbae469f434cc0c36257c6bb3b8 Author: Richard Scheffenegger AuthorDate: 2024-05-01 06:40:40 +0000 Commit: Richard Scheffenegger CommitDate: 2024-05-02 23:02:55 +0000 in_pcb: don't leak credential refcounts on error In the error path during allocating an in_pcb, the credentials associated with the new struct get their reference count increased early on, but not decremented when the allocation fails. Reported by: cmiller_netapp.com MFC after: 3 days Reviewed by: jhb, tuexen Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D45033 (cherry picked from commit 30cf0fbf26243f23631739f406959ce5aaba9f5c) --- sys/netinet/in_pcb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 95e162e60f53..0fffd285fb17 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -657,6 +657,10 @@ in_pcballoc(struct socket *so, struct inpcbinfo *pcbinfo) #if defined(IPSEC) || defined(IPSEC_SUPPORT) || defined(MAC) out: + crfree(inp->inp_cred); +#ifdef INVARIANTS + inp->inp_cred = NULL; +#endif uma_zfree_smr(pcbinfo->ipi_zone, inp); return (error); #endif