Patchwork [2/7] netfilter: nfnetlink_queue: fix incorrect initialization of copy range field

login
register
mail settings
Submitter Pablo Neira
Date March 20, 2013, 10:49 a.m.
Message ID <1363776574-4766-3-git-send-email-pablo@netfilter.org>
Download mbox | patch
Permalink /patch/229359/
State Accepted
Headers show

Comments

Pablo Neira - March 20, 2013, 10:49 a.m.
From: Pablo Neira Ayuso <pablo@netfilter.org>

2^16 = 0xffff, not 0xfffff (note the extra 'f'). Not dangerous since you
adjust it to min_t(data_len, skb->len) just after on.

Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nfnetlink_queue_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Sergei Shtylyov - March 20, 2013, 1:33 p.m.
Hello.

On 20-03-2013 14:49, pablo@netfilter.org wrote:

> From: Pablo Neira Ayuso <pablo@netfilter.org>

> 2^16 = 0xffff,

    2^16-1, to be precise.

> not 0xfffff (note the extra 'f'). Not dangerous since you
> adjust it to min_t(data_len, skb->len) just after on.

> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

WBR, Sergei


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
index 858fd52..1cb4854 100644
--- a/net/netfilter/nfnetlink_queue_core.c
+++ b/net/netfilter/nfnetlink_queue_core.c
@@ -112,7 +112,7 @@  instance_create(u_int16_t queue_num, int portid)
 	inst->queue_num = queue_num;
 	inst->peer_portid = portid;
 	inst->queue_maxlen = NFQNL_QMAX_DEFAULT;
-	inst->copy_range = 0xfffff;
+	inst->copy_range = 0xffff;
 	inst->copy_mode = NFQNL_COPY_NONE;
 	spin_lock_init(&inst->lock);
 	INIT_LIST_HEAD(&inst->queue_list);