netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] fix buf of assigning skb->tail to network_header
@ 2013-03-10  9:48 Hong Zhiguo
  2013-03-10  9:58 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Hong Zhiguo @ 2013-03-10  9:48 UTC (permalink / raw)
  To: netdev, davem, stephen; +Cc: zhiguo.hong, Hong Zhiguo

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

Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
---
 net/ipv4/ipmr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 5f95b3a..553409b 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -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 */
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] fix buf of assigning skb->tail to network_header
  2013-03-10  9:48 [PATCH net-next] fix buf of assigning skb->tail to network_header Hong Zhiguo
@ 2013-03-10  9:58 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2013-03-10  9:58 UTC (permalink / raw)
  To: Hong Zhiguo; +Cc: netdev, davem, stephen, zhiguo.hong

On Sun, 2013-03-10 at 17:48 +0800, Hong Zhiguo wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-10  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-10  9:48 [PATCH net-next] fix buf of assigning skb->tail to network_header Hong Zhiguo
2013-03-10  9:58 ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).