On Fri, Oct 28, 2016 at 4:40 PM, Eric Dumazet <eric.duma...@gmail.com> wrote: > From: Eric Dumazet <eduma...@google.com> > > At accept() time, it is possible the parent has a non zero > sk_err_soft, leftover from a prior error. > > Make sure we do not leave this value in the child, as it > makes future getsockopt(SO_ERROR) calls quite unreliable. > > Signed-off-by: Eric Dumazet <eduma...@google.com> Acked-by: Soheil Hassas Yeganeh <soh...@google.com>
> --- > net/core/sock.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/net/core/sock.c b/net/core/sock.c > index > d8e4532e89e7c28737c95c723e5f5b3d184a7805..662ccf1c40ed1b66ee253b063dcbfbd186deccee > 100644 > --- a/net/core/sock.c > +++ b/net/core/sock.c > @@ -1543,6 +1543,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const > gfp_t priority) > RCU_INIT_POINTER(newsk->sk_reuseport_cb, NULL); > > newsk->sk_err = 0; > + newsk->sk_err_soft = 0; > newsk->sk_priority = 0; > newsk->sk_incoming_cpu = raw_smp_processor_id(); > atomic64_set(&newsk->sk_cookie, 0); > > Very nice catch! Thank you, Eric!