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 50CB03A3E95 for ; Wed, 16 Sep 2026 16:12:27 +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=1789575149; cv=none; b=TzbsQ4B6hWIjwKUIKSBX1f9ciJ8ysUyu0hxQEp22EjEYt9m95pM1pwQdSgETFwHroDDZ1x+R6w2NXqK1z6SxkAezbpubmhkhNFyvuuHNpSUVLIE9xRbPSGgT8auwbc2HiPaowYjp7d3jHiuKjrSgGmm/eZzP8bZN+h/bTvqgIDQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789575149; c=relaxed/simple; bh=BLcUS4K3Hsy2ilnFDnMtmfacUMcj6B8fBkR/CWN2Gm0=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=BAKbJJWwv0yMFK4jVkHddUwMFFbtomHdXKAqcS27izLKDqUtUDdz2iNVCbHF2mcI5nothBMsXkicn4tjrz7YDI4AHPaAZ6F+IVN6Gocuf8hpE6y/T93H/XDkR1nQASVXPXWI8nITt6u4ubTmmo+V9LD5c2WqZs0163FUeX7joCs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TSNymT1p; 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="TSNymT1p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A065F1F000FF; Wed, 16 Sep 2026 16:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789575147; bh=vnt7Yb6ifX0nSqWxRmVtYSBiSb4rHPbodJgMKO+WqDo=; h=Subject:To:Cc:From:Date; b=TSNymT1p/SeWydxusG5+dfTkkKLxe0VFbMm0nR1JVEi53dleieB5Yi/eJUFmCI/VK Vk9rHyLumclZMWD1Upv9APY65Da8KjoTJURxCzFrixXr0nb8RHEb2SsryEdCZ/52lF bXjKOeLLqMygooPoySyx5IJ21GnqvqFyPYfXV114= Subject: FAILED: patch "[PATCH] ipv6: flowlabel: cap duplicate leases per socket" failed to apply to 5.10-stable tree To: zhilinz@nebusec.ai,edumazet@google.com,idosch@nvidia.com,kuba@kernel.org,vega@nebusec.ai Cc: From: Date: Wed, 16 Sep 2026 16:59:57 +0100 Message-ID: <2026091657-spree-snowbound-d932@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x 8d6cd188508513503805c156165de38e4e4a8615 # git commit -s git send-email --to '' --in-reply-to '2026091657-spree-snowbound-d932@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 8d6cd188508513503805c156165de38e4e4a8615 Mon Sep 17 00:00:00 2001 From: Zhiling Zou Date: Thu, 3 Sep 2026 14:23:03 +0800 Subject: [PATCH] ipv6: flowlabel: cap duplicate leases per socket ipv6_flowlabel_get() allocates an ipv6_fl_socklist entry for every successful GET. The recheck path for a compatible existing flowlabel links another lease without applying any lease admission check. Repeated GET requests for one shareable label can therefore grow a socket's lease list without bound. Reject a new unprivileged lease once the socket already holds FL_MAX_PER_SOCK leases. Check this on the shared recheck path so reuse of a globally interned label, including the fl_intern() collision path, is covered as well. New-label admission remains under the existing mem_check() policy. Use capable(CAP_NET_ADMIN) rather than ns_capable(), matching mem_check(). An unprivileged user must not bypass the cap by creating a user namespace and a netns where they have CAP_NET_ADMIN, which would still consume host memory. Check the capability only when the socket reaches the limit, so successful unprivileged GET requests below the cap do not generate a capability audit. Do the admission check before updating linger and expires so a rejected GET does not refresh the shared label, matching the existing socket-list allocation failure path. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reported-by: Vega Suggested-by: Ido Schimmel Signed-off-by: Zhiling Zou Reviewed-by: Eric Dumazet Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/83f8535972ff6e3741548476a1d50dec24c758be.1788415194.git.zhilinz@nebusec.ai Signed-off-by: Jakub Kicinski diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 1ab5ad0dcf24..006585dc8b5c 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c @@ -461,6 +461,21 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq, return NULL; } +static bool fl_sock_at_lease_limit(const struct sock *sk) +{ + const struct ipv6_fl_socklist *sfl; + int count = 0; + + rcu_read_lock(); + for_each_sk_fl_rcu(sk, sfl) { + if (++count >= FL_MAX_PER_SOCK) + break; + } + rcu_read_unlock(); + + return count >= FL_MAX_PER_SOCK; +} + static int mem_check(struct sock *sk) { const int unpriv_total_limit = FL_MAX_SIZE - (FL_MAX_SIZE / 4); @@ -679,6 +694,10 @@ static int ipv6_flowlabel_get(struct sock *sk, struct in6_flowlabel_req *freq, err = -ENOMEM; if (!sfl1) goto release; + err = -ENOBUFS; + if (fl_sock_at_lease_limit(sk) && + !capable(CAP_NET_ADMIN)) + goto release; if (fl->linger > fl1->linger) fl1->linger = fl->linger; if ((long)(fl->expires - fl1->expires) > 0)