[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20171022.032344.624053890646394779.davem@davemloft.net>
Date: Sun, 22 Oct 2017 03:23:44 +0100 (WEST)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net] ipv6: flowlabel: do not leave opt->tot_len with
garbage
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Sat, 21 Oct 2017 12:26:23 -0700
> From: Eric Dumazet <edumazet@...gle.com>
>
> When syzkaller team brought us a C repro for the crash [1] that
> had been reported many times in the past, I finally could find
> the root cause.
>
> If FlowLabel info is merged by fl6_merge_options(), we leave
> part of the opt_space storage provided by udp/raw/l2tp with random value
> in opt_space.tot_len, unless a control message was provided at sendmsg()
> time.
>
> Then ip6_setup_cork() would use this random value to perform a kzalloc()
> call. Undefined behavior and crashes.
>
> Fix is to properly set tot_len in fl6_merge_options()
>
> At the same time, we can also avoid consuming memory and cpu cycles
> to clear it, if every option is copied via a kmemdup(). This is the
> change in ip6_setup_cork().
Nice detective work.
Applied and queued up for -stable.
Powered by blists - more mailing lists