From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F35D443CEC7; Tue, 16 Jun 2026 18:44:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781635456; cv=none; b=eodBQgE89hPju1cBxbLZkOPgYeVllJh0e0By/DV50iV+HvQzJmnq9z1O37aCCQDGV78fGWOt6XMRPPz3mWvGSkyTgcJmqPVU76QCTQMqjWe+WLwJHlc2C1HTUjnmEi48LsK5ZRzjTgEqhkOGP81YOAkv6zmp52NxjS6/yUW31WA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781635456; c=relaxed/simple; bh=zGR+MR4x+EnpRQ2ciSBkDfJmpGF8mHSfdivdzG+CHYs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PjwpiMuIcyZdjnjVgvrpo7zqEFWFy/zQbohdMk3Lq/Cc7bXL32wULqnfKhng8TGLswQzRkpkg3yqyGXO+aKA85iBG8kbnlpQaAkPce1LjFaIiU9O8JWS23s1ZnZPwLcCZp0BPD9KGsHS9JyXcY8DRr7NqpGbRmh2cdZF4kBn7t4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DfDKPfNT; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DfDKPfNT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0061F1F000E9; Tue, 16 Jun 2026 18:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781635455; bh=QCU0s5bboVt6oJOkpjuiJ4biJzQEZnlCWvm4Y6WyfPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DfDKPfNTs96dhk/HmJM8EeIY0puR65Mm/Bm1G/ydcGLEieBlH2XRjLCQ56p6YEpib E1z/xmq36ed2ZUQaPKOKUcbApTTrVCguIVHirgRxjsQQi71Qh8Zzn1M4+0Qhy5fCFy K5Z3x2smOyz31oCLcR6/YGfP0HKIFE/r0/et1GGg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jian Zhou , Eric Dumazet , Cong Wang , Jason Xing , Jiayuan Chen , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 019/342] ipv4: free net->ipv4.sysctl_local_reserved_ports after unregister_net_sysctl_table() Date: Tue, 16 Jun 2026 20:25:15 +0530 Message-ID: <20260616145049.161797088@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145048.348037099@linuxfoundation.org> References: <20260616145048.348037099@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit 87a1e0fe7776da7ab411be332b4be58ac8840d10 ] ipv4_sysctl_exit_net() is currently freeing net->ipv4.sysctl_local_reserved_ports too soon. Only after unregister_net_sysctl_table() we can be sure no threads can possibly use the sysctls, including /proc/sys/net/ipv4/ip_local_reserved_ports. Fixes: 122ff243f5f1 ("ipv4: make ip_local_reserved_ports per netns") Reported-by: Ji'an Zhou Signed-off-by: Eric Dumazet Cc: Cong Wang Reviewed-by: Jason Xing Reviewed-by: Jiayuan Chen Link: https://patch.msgid.link/20260521122147.3584624-1-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/sysctl_net_ipv4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 59ba518a85b9c9..56c60af2a32f25 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -1362,10 +1362,10 @@ static __net_exit void ipv4_sysctl_exit_net(struct net *net) { struct ctl_table *table; - kfree(net->ipv4.sysctl_local_reserved_ports); table = net->ipv4.ipv4_hdr->ctl_table_arg; unregister_net_sysctl_table(net->ipv4.ipv4_hdr); kfree(table); + kfree(net->ipv4.sysctl_local_reserved_ports); } static __net_initdata struct pernet_operations ipv4_sysctl_ops = { -- 2.53.0