In the Linux kernel, the following vulnerability has been resolved:
netfilter: nft_set_pipapo: dont leak bad clone into future transaction
On memory allocation failure the cloned nft_pipapo_match can enter a bad state:
This means that the next insertion in the same batch can trigger out-of-bounds writes.
Furthermore, a failure in the first can result in the bad clone to leak into the next transaction because the abort callback is never executed in this case (the upper layer saw an error and no attempt to allocate a transactional request was made).
Record a state for the nft_pipapo_match structure:
Then make it so that deletes and insertions fail when the clone entered ERR state.
In case the very first insert attempt results in an error, free the clone right away.