netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4: fix ip header ident selection in __ip_make_skb()
@ 2012-08-20 17:26 Eric Dumazet
  2012-08-21 21:51 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2012-08-20 17:26 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Stephen Hemminger, Christian Casteyde

From: Eric Dumazet <edumazet@google.com>

Christian Casteyde reported a kmemcheck 32-bit read from uninitialized
memory in __ip_select_ident().

It turns out that __ip_make_skb() called ip_select_ident() before
properly initializing iph->daddr.

This is a bug uncovered by commit 1d861aa4b3fb (inet: Minimize use of
cached route inetpeer.)

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=46131

Reported-by: Christian Casteyde <casteyde.christian@free.fr>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>
---
 net/ipv4/ip_output.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 147ccc3..c196d74 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1338,10 +1338,10 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
 	iph->ihl = 5;
 	iph->tos = inet->tos;
 	iph->frag_off = df;
-	ip_select_ident(iph, &rt->dst, sk);
 	iph->ttl = ttl;
 	iph->protocol = sk->sk_protocol;
 	ip_copy_addrs(iph, fl4);
+	ip_select_ident(iph, &rt->dst, sk);
 
 	if (opt) {
 		iph->ihl += opt->optlen>>2;

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

* Re: [PATCH] ipv4: fix ip header ident selection in __ip_make_skb()
  2012-08-20 17:26 [PATCH] ipv4: fix ip header ident selection in __ip_make_skb() Eric Dumazet
@ 2012-08-21 21:51 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-08-21 21:51 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, shemminger, casteyde.christian

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 20 Aug 2012 19:26:45 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> Christian Casteyde reported a kmemcheck 32-bit read from uninitialized
> memory in __ip_select_ident().
> 
> It turns out that __ip_make_skb() called ip_select_ident() before
> properly initializing iph->daddr.
> 
> This is a bug uncovered by commit 1d861aa4b3fb (inet: Minimize use of
> cached route inetpeer.)
> 
> Addresses https://bugzilla.kernel.org/show_bug.cgi?id=46131
> 
> Reported-by: Christian Casteyde <casteyde.christian@free.fr>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Stephen Hemminger <shemminger@vyatta.com>

Applied, thanks Eric.

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

end of thread, other threads:[~2012-08-21 21:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20 17:26 [PATCH] ipv4: fix ip header ident selection in __ip_make_skb() Eric Dumazet
2012-08-21 21:51 ` David Miller

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).