From: Eric Dumazet Date: Fri, 28 Oct 2016 20:40:24 +0000 (-0700) Subject: net: clear sk_err_soft in sk_clone_lock() X-Git-Tag: v3.12.68~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11c4d5f9c7f85b14665b7f3ebfeb3cb319f5cb1e;p=thirdparty%2Fkernel%2Fstable.git net: clear sk_err_soft in sk_clone_lock() [ Upstream commit e551c32d57c88923f99f8f010e89ca7ed0735e83 ] 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 Acked-by: Soheil Hassas Yeganeh Signed-off-by: David S. Miller Signed-off-by: Jiri Slaby --- diff --git a/net/core/sock.c b/net/core/sock.c index 516b45c820931..73c6093e136a6 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1537,6 +1537,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) } newsk->sk_err = 0; + newsk->sk_err_soft = 0; newsk->sk_priority = 0; /* * Before updating sk_refcnt, we must commit prior changes to memory