Skip to contentSkip to conversation

fix buf of assigning skb->tail to network_header

PATCH In review Hong Zhiguo 2 participants 2 messages Mar 10, 2013

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

PATCH 1/1 fix buf of assigning skb->tail to network_header

in the case of NET_SKBUFF_DATA_USES_OFFSET, direct pointer assignment to skb->network_header is a dangerous bug.

---
 net/ipv4/ipmr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/ipmr.c +1 -1
index 5f95b3a..553409b 100644
@@ -980,7 +980,7 @@ static int ipmr_cache_report(struct mr_table *mrt,
 
 	/* Copy the IP header */
 
-	skb->network_header = skb->tail;
+	skb_set_network_header(skb, skb->tail - skb->data);
 	skb_put(skb, ihl);
 	skb_copy_to_linear_data(skb, pkt->data, ihl);
 	ip_hdr(skb)->protocol = 0;	/* Flag to the kernel this is a route add */
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 2 lines · Hong Zhiguo

in the case of NET_SKBUFF_DATA_USES_OFFSET, direct pointer assignment to skb->network_header is a dangerous bug.

But skb->tail is not a pointer.

Really you need to explain more than this confusing changelog