From nobody Mon Jan 22 18:45:26 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 4TJfKz0MPXz57yx9; Mon, 22 Jan 2024 18:45:27 +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 4TJfKy6v7Zz4vD6; Mon, 22 Jan 2024 18:45:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705949127; 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=IA8WbfLNYxZ/j/lYMPZqSt07JkULneoas8h4OUCsRZs=; b=CPvEKXljzn11hnoYbR0Uy6nqFtt1sl76eHHCM5wjl4a9TlS+Ukmc4tMRm7EgaZII7inWAk w4+ozfqE6LjETlb2HWbU1z1mf64POJOOnnhz7JNO2MqgqNAY6ZFb40oTVI0soGipjfgKcM W8Dn2QbM/T+uwEmcNyClKhA67e46Er0NY6nCGNJD+dsRm77POvWSwyU9fSvZvdqFOiFqVS Ojm6YV1Okpd/FFuoFanqzi+b9jWf4Sc9Ss/4AcY2vtcZzOfBPe+QI5dgFlKl7bpNjEKuQo myj6I+QE1w7xZVck6NUM0IU9SLehm5Ykzxe6Ad5T+DaRK0zfXdTTKj2JvsDgsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705949127; 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=IA8WbfLNYxZ/j/lYMPZqSt07JkULneoas8h4OUCsRZs=; b=N8fVFiaJbEwBbDKfgR7Hoj6ZfuWplEhygQ4mrlwlx6HcuHLT8f/JOP3UA8xjAvPBa6GqEC khK+2CSz24SE9awGS8ljww6B+y5L0ktW5iXjC9ffp0tLj2WXbhtIvkYNrhRqS600tmmWDU 1oO05c4J8JUFPuhLy6ZnQzreDnNimR2shg0gatyj7Z9k5v+/rhcyxIJv5sN7RFAl3JLR5i oBtkDQy8AHoZ2H5nWP9VUqf+e+j8cmAWV7WUN+k1gmYCUNNX9Z7tr6+5xMeZ6qLn7rd5MQ tISPScfAL7hxUron/m6P5yyYBY/0ijVEKWlBju/X4p8PKNSwTDBanWB5CELfpg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705949127; a=rsa-sha256; cv=none; b=yHtONoaB1lQ9yfYQsPut3L8eN1VRKReUp45vZ9b8ahTy7nubYkrpUaax6PGdMyO+56b3Jh YjJLB34TBdIO8CWhmktlmv02A3ZBoMGmCz4QDfKknLxYAh38JXtiaoAd2xC7VEz9yR3bAA ncAw7n07zmjTAjudcZPGl85nuAOMMIRQ168wB1iL48Ic8MD+EtzmnOkDnNis+e+Pnz/czH yTHNzrJNRx6stZFACkh/XJmblZAgUuB347MXHTVp8NC2N8fqnjRxW7J4n7+iCTXHkW/gXQ 8gWU9YLJK/NVLjbQ3F7Ya7Fb9ikTBnv47lkxDi84waEqq+VVBf4v8P3wfbgOIg== 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 4TJfKy61BJz1CXr; Mon, 22 Jan 2024 18:45:26 +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 40MIjQ1g042823; Mon, 22 Jan 2024 18:45:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40MIjQII042821; Mon, 22 Jan 2024 18:45:26 GMT (envelope-from git) Date: Mon, 22 Jan 2024 18:45:26 GMT Message-Id: <202401221845.40MIjQII042821@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 0ea32f0e8376 - stable/13 - inpcb: Remove a PCB from its LB group upon a subsequent 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0ea32f0e83769ca1c6ebc40fb0a3a0e64a24e7a0 Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0ea32f0e83769ca1c6ebc40fb0a3a0e64a24e7a0 commit 0ea32f0e83769ca1c6ebc40fb0a3a0e64a24e7a0 Author: Mark Johnston AuthorDate: 2022-11-02 17:05:14 +0000 Commit: Mark Johnston CommitDate: 2024-01-22 18:45:03 +0000 inpcb: Remove a PCB from its LB group upon a subsequent error If a memory allocation failure causes bind to fail, we should take the inpcb back out of its LB group since it's not prepared to handle connections. Reviewed by: glebius MFC after: 2 weeks Sponsored by: Modirum MDPay Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D37027 (cherry picked from commit a152dd863418638c3eb08b5c101b10b82f8072f5) --- sys/netinet/in_pcb.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 3f4ad6752aae..3f8db305d3c9 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -2646,7 +2646,6 @@ in_pcbinshash_internal(struct inpcb *inp, struct mbuf *m) struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; struct inpcbport *phd; u_int32_t hashkey_faddr; - int so_options; INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(pcbinfo); @@ -2671,13 +2670,10 @@ in_pcbinshash_internal(struct inpcb *inp, struct mbuf *m) * Add entry to load balance group. * Only do this if SO_REUSEPORT_LB is set. */ - so_options = inp_so_options(inp); - if (so_options & SO_REUSEPORT_LB) { - int ret = in_pcbinslbgrouphash(inp, M_NODOM); - if (ret) { - /* pcb lb group malloc fail (ret=ENOBUFS). */ - return (ret); - } + if ((inp->inp_flags2 & INP_REUSEPORT_LB) != 0) { + int error = in_pcbinslbgrouphash(inp, M_NODOM); + if (error != 0) + return (error); } /* @@ -2687,13 +2683,16 @@ in_pcbinshash_internal(struct inpcb *inp, struct mbuf *m) if (phd->phd_port == inp->inp_lport) break; } + /* * If none exists, malloc one and tack it on. */ if (phd == NULL) { phd = malloc(sizeof(struct inpcbport), M_PCB, M_NOWAIT); if (phd == NULL) { - return (ENOBUFS); /* XXX */ + if ((inp->inp_flags2 & INP_REUSEPORT_LB) != 0) + in_pcbremlbgrouphash(inp); + return (ENOMEM); } bzero(&phd->phd_epoch_ctx, sizeof(struct epoch_context)); phd->phd_port = inp->inp_lport;