From nobody Thu May 02 07:20:58 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 4VVQMZ3prBz5JTBg; Thu, 2 May 2024 07:20: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 4VVQMZ3NhSz4RNf; Thu, 2 May 2024 07:20:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714634458; 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=GXKvuxFwELsW7woPq7RPvK63L18Llp+dZ8sbgsP4u6g=; b=Sdr4o2BqpG/Yl2Ooe1EQlNLs5mT8xXTWbTHIUvTxO1o4TZb2iR3kjuBYzWeruLcqBiwuKp zAB/l+K0mJGqhIaAAGnrZH/HikfCbKjoGI2p+TdFk87NsllrahT3ltcCyk6T3dw46kRGz2 +9aSHHizaL+1BEDV1JFr/HUwhczFLx+qVrgk7BIeznjdkyArMruNqTCg/qB91bYepLyhlo 59atYmRHbEw1H0y21dCTZZZQ42L6tFxenIz4x561x0THj+QOX2yY3JtKeRssmNdgTspFO8 lLII3p2pAqBDfUEMJnqUa/Br/keyEquOnyAEOp3c6f6bWltubI6y/vHW3SI/8A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714634458; a=rsa-sha256; cv=none; b=aS33xwGTpArKsfIomMn8s4unkKsEdff3R/DExi9zrNPneYJEu2eYeClq3ZkoiwgkOCJL7c c+8LjF+ZkW94GccS+zDCL+L0/vAT6Xd/+8dzwgNqApbTH6JSqeB232NzlFRr33vLCcATAX Wu2jNKWrAAUMC9jg0VarxZ0c64zeq8sIjVHi38G5QPtsIapjkAWrpCeoCcIkwqiX+PDef4 d3lq2jssat7ZjRrE8uNyWTkSaTvdiKYPXYbeKkxdYyEmkHLaBl0b2yQagMg+lsw8iQYoXD 6a8tmoDaa0t8eB5TOrGs3sbTsTpWmMAjrCjEZDZU+Za6Qs0vq406tPTB7xvKsA== 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=1714634458; 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=GXKvuxFwELsW7woPq7RPvK63L18Llp+dZ8sbgsP4u6g=; b=ALRuT081ibTc9hVrAqHLXiyqI5jbv0pGlZYwyTX0WFUeUVOIa5r9KU8RyGtfUwe9Fz93GW tjqWgippmE59z3ZJT/TAnPIK88fzMmyZz5UFmf61w/xwaBl6ZGgvgiWPsx/j+t9QbXaQED 1/C68qy7H4IsC7WI6gJFc1DxYaLczHbOKB2gs2pN9Bb7B8KxVFmI2pSOgOj+AVCJkoqa5P lxG2YmlztjESF4PLfy2N53H62SEtfPsGPRkl47HxtoGGU7gRs6RhyNusMge2dWnu6wFRTt 8cOrt3oFw69aVdWpDLOui7JkAPgtXnCNK8FDIwxULu4ATi7oGIDDbuDBQSM/rA== 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 4VVQMZ30wfzt4D; Thu, 2 May 2024 07:20: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 4427Kw4W063540; Thu, 2 May 2024 07:20:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4427Kwv7063537; Thu, 2 May 2024 07:20:58 GMT (envelope-from git) Date: Thu, 2 May 2024 07:20:58 GMT Message-Id: <202405020720.4427Kwv7063537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 30cf0fbf2624 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 30cf0fbf26243f23631739f406959ce5aaba9f5c Auto-Submitted: auto-generated The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=30cf0fbf26243f23631739f406959ce5aaba9f5c commit 30cf0fbf26243f23631739f406959ce5aaba9f5c Author: Richard Scheffenegger AuthorDate: 2024-05-01 06:40:40 +0000 Commit: Richard Scheffenegger CommitDate: 2024-05-01 06:41:26 +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 --- 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 d9caad6417ef..1a341d421f31 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -655,6 +655,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