Skip to content

Commit

Permalink
net: clear sk_err_soft in sk_clone_lock()
Browse files Browse the repository at this point in the history
[ Upstream commit e551c32 ]

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 <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
  • Loading branch information
Eric Dumazet authored and bwhacks committed Mar 16, 2017
1 parent 74761f6 commit 5a47926
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,7 @@ struct sock *sk_clone(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
Expand Down

0 comments on commit 5a47926

Please sign in to comment.