Skip to contentSkip to conversation

netfilter: nf_queue:fix reinject verdict handling

PATCH Applied Jagdish Motwani 2 participants 2 messages May 13, 2019 – May 21, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 netfilter: nf_queue:fix reinject verdict handling

From: Jagdish Motwani <[email protected]>

This patch fixes netfilter hook traversal when there are more than 1 hooks returning NF_QUEUE verdict. When the first queue reinjects the packet, 'nf_reinject' starts traversing hooks with a proper hook_index. However, if it again receives a NF_QUEUE verdict (by some other netfilter hook), it queues the packet with a wrong hook_index. So, when the second queue reinjects the packet, it re-executes hooks in between.

Fixes 960632ece694 ("netfilter: convert hook list to an array")
---
 net/netfilter/nf_queue.c | 1 +
 1 file changed, 1 insertion(+)
net/netfilter/nf_queue.c +1 -0
index 9dc1d6e..b5b2be5 100644
@@ -255,6 +255,7 @@ static unsigned int nf_iterate(struct sk_buff *skb,
 repeat:
 		verdict = nf_hook_entry_hookfn(hook, skb, state);
 		if (verdict != NF_ACCEPT) {
+			*index = i;
 			if (verdict != NF_REPEAT)
 				return verdict;
 			goto repeat;
Signature · 1 line
2.9.5
maintainer Applied
#1 lore raw
Quoted 8 lines · Jagdish Motwani

From: Jagdish Motwani <[email protected]>

This patch fixes netfilter hook traversal when there are more than 1 hooks returning NF_QUEUE verdict. When the first queue reinjects the packet, 'nf_reinject' starts traversing hooks with a proper hook_index. However, if it again receives a NF_QUEUE verdict (by some other netfilter hook), it queues the packet with a wrong hook_index. So, when the second queue reinjects the packet, it re-executes hooks in between.

Applied, thanks.