public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Natarajan KV <natarajankv91@gmail.com>
To: stable@vger.kernel.org
Cc: gregkh@linuxfoundation.org, pablo@netfilter.org,
	kadlec@netfilter.org, fw@strlen.de
Subject: [PATCH v3 6.6.y 0/8] netfilter: nft_set_pipapo: move clone allocation to insert/removal path
Date: Wed, 04 Mar 2026 20:54:38 +0400	[thread overview]
Message-ID: <1772643278.pipapo-v3.0@gmail.com> (raw)
In-Reply-To: <2026030421-grunt-raft-15f0@gregkh>

This is a backport of the following mainline series to 6.6.122:

  a590f4760922 ("netfilter: nft_set_pipapo: move prove_locking helper around")
  80efd2997fb9 ("netfilter: nft_set_pipapo: make pipapo_clone helper return NULL")
  8b8a2417558c ("netfilter: nft_set_pipapo: prepare destroy function for on-demand clone")
  6c108d9bee44 ("netfilter: nft_set_pipapo: prepare walk function for on-demand clone")
  c5444786d0ea ("netfilter: nft_set_pipapo: merge deactivate helper into caller")
  a238106703ab ("netfilter: nft_set_pipapo: prepare pipapo_get helper for on-demand clone")
  3f1d886cc7c3 ("netfilter: nft_set_pipapo: move cloning of match info to insert/removal path")
  532aec7e878b ("netfilter: nft_set_pipapo: remove dirty flag")

The pipapo set backend currently calls pipapo_clone() from the commit
and abort callbacks. These callbacks must not fail, but pipapo_clone()
can fail with ENOMEM. When this happens, the working copy ends up in a
corrupt state: freed elements remain accessible, and the dirty flag stays
set, causing the next commit to promote a stale clone.

This series moves pipapo_clone() to the insert and removal paths via a
new pipapo_maybe_clone() helper that creates the working copy on demand
and can propagate -ENOMEM to the caller.

Patches 1-4 cherry-pick cleanly from mainline.
Patches 5-8 are adapted for 6.6.122's different API:
 - nft_pipapo_flush() still uses the pipapo_deactivate() helper
   (mainline removed it via the elem_priv refactor)
 - pipapo_get() has no GFP parameter (always GFP_ATOMIC)
 - nft_pipapo_commit() is non-const in 6.6.x

Build-tested with both nft_set_pipapo.o and nft_set_pipapo_avx2.o.

Florian Westphal (8):
  netfilter: nft_set_pipapo: move prove_locking helper around
  netfilter: nft_set_pipapo: make pipapo_clone helper return NULL
  netfilter: nft_set_pipapo: prepare destroy function for on-demand clone
  netfilter: nft_set_pipapo: prepare walk function for on-demand clone
  netfilter: nft_set_pipapo: merge deactivate helper into caller
  netfilter: nft_set_pipapo: prepare pipapo_get helper for on-demand clone
  netfilter: nft_set_pipapo: move cloning of match info to insert/removal path
  netfilter: nft_set_pipapo: remove dirty flag

 net/netfilter/nft_set_pipapo.c | 196 +++++++++++++++++---------------
 net/netfilter/nft_set_pipapo.h |   6 --
 2 files changed, 107 insertions(+), 95 deletions(-)

-- 
2.39.5

  reply	other threads:[~2026-03-04 16:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 13:38 [PATCH] netfilter: nft_set_pipapo: clear dirty flag on abort/commit clone failure Natarajan KV
2026-03-04 13:47 ` Greg KH
2026-03-04 13:50 ` Florian Westphal
2026-03-04 15:08 ` [PATCH v2] netfilter: nft_set_pipapo: move clone allocation to insert/removal path Natarajan KV
2026-03-04 15:12   ` Greg KH
2026-03-04 16:54     ` Natarajan KV [this message]
2026-03-04 16:54       ` [PATCH v3 6.6.y 1/8] netfilter: nft_set_pipapo: move prove_locking helper around Natarajan KV
2026-03-04 16:54       ` [PATCH v3 6.6.y 2/8] netfilter: nft_set_pipapo: make pipapo_clone helper return NULL Natarajan KV
2026-03-04 16:55       ` [PATCH v3 6.6.y 3/8] netfilter: nft_set_pipapo: prepare destroy function for on-demand clone Natarajan KV
2026-03-04 16:55       ` [PATCH v3 6.6.y 4/8] netfilter: nft_set_pipapo: prepare walk " Natarajan KV
2026-03-04 16:55       ` [PATCH v3 6.6.y 5/8] netfilter: nft_set_pipapo: merge deactivate helper into caller Natarajan KV
2026-03-04 16:55       ` [PATCH v3 6.6.y 6/8] netfilter: nft_set_pipapo: prepare pipapo_get helper for on-demand clone Natarajan KV
2026-03-04 16:55       ` [PATCH v3 6.6.y 7/8] netfilter: nft_set_pipapo: move cloning of match info to insert/removal path Natarajan KV
2026-03-04 16:55       ` [PATCH v3 6.6.y 8/8] netfilter: nft_set_pipapo: remove dirty flag Natarajan KV
2026-03-04 21:30       ` [PATCH v3 6.6.y 0/8] netfilter: nft_set_pipapo: move clone allocation to insert/removal path Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1772643278.pipapo-v3.0@gmail.com \
    --to=natarajankv91@gmail.com \
    --cc=fw@strlen.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kadlec@netfilter.org \
    --cc=pablo@netfilter.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox