Skip to content

Commit a9915a1

Browse files
edumazetdavem330
authored andcommitted
ipv4: fix ip header ident selection in __ip_make_skb()
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 1d861aa (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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1a7b27c commit a9915a1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/ipv4/ip_output.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,10 +1338,10 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
13381338
iph->ihl = 5;
13391339
iph->tos = inet->tos;
13401340
iph->frag_off = df;
1341-
ip_select_ident(iph, &rt->dst, sk);
13421341
iph->ttl = ttl;
13431342
iph->protocol = sk->sk_protocol;
13441343
ip_copy_addrs(iph, fl4);
1344+
ip_select_ident(iph, &rt->dst, sk);
13451345

13461346
if (opt) {
13471347
iph->ihl += opt->optlen>>2;

0 commit comments

Comments
 (0)