From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D148936828A; Mon, 9 Feb 2026 14:43:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770648213; cv=none; b=Bra6JEXGJ2rnhwaQ0GIZaQVhKw7VyWgYl3YoxUiW/Q33lSRSam1AUciD0MRiSPi/MD3xMnP1rCUn5Fxbx/5eTw2gK8aQ298HFI2AYo41vqQIfrplSXw2FQh/4hQ9zh7qBuDrJHI7FzSJrLdcUWI90CfEv90RN84qpn2FUTbrH3w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770648213; c=relaxed/simple; bh=RS9Hr8D6Dfus8tJga3OU0e1K/eX2KTXQ/jghtUsrLqA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hPX9++/ONyJ70Kz5eAiq1ghbChiJI6jfonFCsDTi3rPVTyLyZP+hjfjNSibp9CP723phloQNgezdTqbGDCOqs98rEwptYZwPZ24r0GUpkcqOBbRsZS2FhyImVdoZLViRtJhnadZ/oL6USo99lkHpUonMThmMPWKfKyNpEbzAwBM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cmP6R7my; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="cmP6R7my" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 353F1C16AAE; Mon, 9 Feb 2026 14:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770648213; bh=RS9Hr8D6Dfus8tJga3OU0e1K/eX2KTXQ/jghtUsrLqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cmP6R7my4cmPGPnX4grQX82XwnMFUjlRl/Dfn439WrwO5uo83ZXN9WOdMULsX3TKg NdSl1HbBCW/0G8dGTY6BIcYwxLipK3Tni9gbZOq5JokMLxS+Dd3+proUWAFiKCrTLT WQfcqYPsGkEUnp8IGi11UUlzkM5zCknfwkVoegA4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Stefano Brivio , Pablo Neira Ayuso , Keerthana K Subject: [PATCH 6.1 08/69] netfilter: nft_set_pipapo: clamp maximum map bucket size to INT_MAX Date: Mon, 9 Feb 2026 15:23:36 +0100 Message-ID: <20260209142302.217507869@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260209142301.913348974@linuxfoundation.org> References: <20260209142301.913348974@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pablo Neira Ayuso commit b85e3367a5716ed3662a4fe266525190d2af76df upstream. Otherwise, it is possible to hit WARN_ON_ONCE in __kvmalloc_node_noprof() when resizing hashtable because __GFP_NOWARN is unset. Similar to: b541ba7d1f5a ("netfilter: conntrack: clamp maximum hashtable size to INT_MAX") Reviewed-by: Stefano Brivio Signed-off-by: Pablo Neira Ayuso [ Keerthana: Handle freeing new_lt ] Signed-off-by: Keerthana K Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nft_set_pipapo.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/net/netfilter/nft_set_pipapo.c +++ b/net/netfilter/nft_set_pipapo.c @@ -667,6 +667,11 @@ static int pipapo_resize(struct nft_pipa } mt: + if (rules > (INT_MAX / sizeof(*new_mt))) { + kvfree(new_lt); + return -ENOMEM; + } + new_mt = kvmalloc(rules * sizeof(*new_mt), GFP_KERNEL); if (!new_mt) { kvfree(new_lt); @@ -1360,6 +1365,9 @@ static struct nft_pipapo_match *pipapo_c src->bsize * sizeof(*dst->lt) * src->groups * NFT_PIPAPO_BUCKETS(src->bb)); + if (src->rules > (INT_MAX / sizeof(*src->mt))) + goto out_mt; + dst->mt = kvmalloc(src->rules * sizeof(*src->mt), GFP_KERNEL); if (!dst->mt) goto out_mt;