Skip to contentSkip to conversation

skbuff: skb_mac_header_was_set is always true on >32 bit

RFC Applied Stephen Hemminger 3 participants 3 messages Jun 17, 2009 – Jun 18, 2009

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

RFC 1/1 skbuff: skb_mac_header_was_set is always true on >32 bit

Looking at the crash in log_martians(), one suspect is that the check for mac header being set is not correct. The value of mac_header defaults to 0 on allocation, therefore skb_mac_header_was_set will always be true on platforms using NET_SKBUFF_USES_OFFSET.

Arnaldo, is this correct?

net/core/skbuff.c +4 -0
@@ -201,6 +201,10 @@ struct sk_buff *__alloc_skb(unsigned int
 	skb->data = data;
 	skb_reset_tail_pointer(skb);
 	skb->end = skb->tail + size;
+#ifdef NET_SKBUFF_DATA_USES_OFFSET
+	skb->mac_header = ~0U;
+#endif
+
 	/* make sure we initialize shinfo sequentially */
 	shinfo = skb_shinfo(skb);
 	atomic_set(&shinfo->dataref, 1);
Acked-by on v1 1/1
#1 lore raw

Em Wed, Jun 17, 2009 at 08:23:27AM -0700, Stephen Hemminger escreveu:

Quoted 8 lines

Looking at the crash in log_martians(), one suspect is that the check for mac header being set is not correct. The value of mac_header defaults to 0 on allocation, therefore skb_mac_header_was_set will always be true on platforms using NET_SKBUFF_USES_OFFSET.

Arnaldo, is this correct?

Yeah, looks right, I forgot to initialize it to the value I changed the test in skb_mac_header_was_set when doing the offset patch :-\

Thanks!

Quoted 13 lines
net/core/skbuff.c +4 -0
@@ -201,6 +201,10 @@ struct sk_buff *__alloc_skb(unsigned int
 	skb->data = data;
 	skb_reset_tail_pointer(skb);
 	skb->end = skb->tail + size;
+#ifdef NET_SKBUFF_DATA_USES_OFFSET
+	skb->mac_header = ~0U;
+#endif
+
 	/* make sure we initialize shinfo sequentially */
 	shinfo = skb_shinfo(skb);
 	atomic_set(&shinfo->dataref, 1);
maintainer Applied
#2 lore raw

From: Arnaldo Carvalho de Melo <[email protected]>
Date: Wed, 17 Jun 2009 13:37:16 -0300

Quoted 8 lines

Em Wed, Jun 17, 2009 at 08:23:27AM -0700, Stephen Hemminger escreveu:

Quoted 7 lines

Looking at the crash in log_martians(), one suspect is that the check for mac header being set is not correct. The value of mac_header defaults to 0 on allocation, therefore skb_mac_header_was_set will always be true on platforms using NET_SKBUFF_USES_OFFSET.

Arnaldo, is this correct?

Quoted 8 lines
Quoted 1 line

Yeah, looks right, I forgot to initialize it to the value I changed the test in skb_mac_header_was_set when doing the offset patch :-\

Thanks!

Applied.