All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: clear sk_err_soft in sk_clone_lock()
@ 2016-10-28 20:40 Eric Dumazet
  2016-10-28 21:25 ` Soheil Hassas Yeganeh
  2016-10-31 19:26 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2016-10-28 20:40 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Soheil Hassas Yeganeh

From: Eric Dumazet <edumazet@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 <edumazet@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);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: clear sk_err_soft in sk_clone_lock()
  2016-10-28 20:40 [PATCH net] net: clear sk_err_soft in sk_clone_lock() Eric Dumazet
@ 2016-10-28 21:25 ` Soheil Hassas Yeganeh
  2016-10-31 19:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Soheil Hassas Yeganeh @ 2016-10-28 21:25 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev

On Fri, Oct 28, 2016 at 4:40 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@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 <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@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!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: clear sk_err_soft in sk_clone_lock()
  2016-10-28 20:40 [PATCH net] net: clear sk_err_soft in sk_clone_lock() Eric Dumazet
  2016-10-28 21:25 ` Soheil Hassas Yeganeh
@ 2016-10-31 19:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-10-31 19:26 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, soheil

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 28 Oct 2016 13:40:24 -0700

> From: Eric Dumazet <edumazet@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 <edumazet@google.com>

Applied and queued up for -stable, thanks Eric.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-31 19:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-28 20:40 [PATCH net] net: clear sk_err_soft in sk_clone_lock() Eric Dumazet
2016-10-28 21:25 ` Soheil Hassas Yeganeh
2016-10-31 19:26 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.