All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] [PATCH net] mptcp: fix uninitialized value access
@ 2020-04-29 10:50 ` Paolo Abeni
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Abeni @ 2020-04-29 10:50 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 981 bytes --]

tcp_v{4,6}_syn_recv_sock() set 'own_req' only when returning
a not NULL 'child', let's check 'own_req' only if child is
available to avoid an - unharmful - UBSAN splat.

Fixes: 20882e2cb904 ("mptcp: avoid flipping mp_capable field in syn_recv_sock()")
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
---
 net/mptcp/subflow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index f412e886aa9b..2fa319a36ea5 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -522,7 +522,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 	/* check for expected invariant - should never trigger, just help
 	 * catching eariler subtle bugs
 	 */
-	WARN_ON_ONCE(*own_req && child && tcp_sk(child)->is_mptcp &&
+	WARN_ON_ONCE(child && *own_req && tcp_sk(child)->is_mptcp &&
 		     (!mptcp_subflow_ctx(child) ||
 		      !mptcp_subflow_ctx(child)->conn));
 	return child;
-- 
2.21.1

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

* [PATCH net] mptcp: fix uninitialized value access
@ 2020-04-29 10:50 ` Paolo Abeni
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Abeni @ 2020-04-29 10:50 UTC (permalink / raw)
  To: netdev
  Cc: Mat Martineau, Matthieu Baerts, David S. Miller, Jakub Kicinski, mptcp

tcp_v{4,6}_syn_recv_sock() set 'own_req' only when returning
a not NULL 'child', let's check 'own_req' only if child is
available to avoid an - unharmful - UBSAN splat.

Fixes: 20882e2cb904 ("mptcp: avoid flipping mp_capable field in syn_recv_sock()")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/mptcp/subflow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index f412e886aa9b..2fa319a36ea5 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -522,7 +522,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 	/* check for expected invariant - should never trigger, just help
 	 * catching eariler subtle bugs
 	 */
-	WARN_ON_ONCE(*own_req && child && tcp_sk(child)->is_mptcp &&
+	WARN_ON_ONCE(child && *own_req && tcp_sk(child)->is_mptcp &&
 		     (!mptcp_subflow_ctx(child) ||
 		      !mptcp_subflow_ctx(child)->conn));
 	return child;
-- 
2.21.1


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

* [MPTCP] Re: [PATCH net] mptcp: fix uninitialized value access
  2020-04-29 10:50 ` Paolo Abeni
@ 2020-04-29 18:56 ` David Miller
  -1 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-04-29 18:56 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

From: Paolo Abeni <pabeni(a)redhat.com>
Date: Wed, 29 Apr 2020 12:50:37 +0200

> Fixes: 20882e2cb904 ("mptcp: avoid flipping mp_capable field in syn_recv_sock()")

[davem(a)localhost net]$ git describe 20882e2cb904
fatal: Not a valid object name 20882e2cb904
[davem(a)localhost net]$ 

Please fix this.

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

* Re: [PATCH net] mptcp: fix uninitialized value access
@ 2020-04-29 18:56 ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-04-29 18:56 UTC (permalink / raw)
  To: pabeni; +Cc: netdev, mathew.j.martineau, matthieu.baerts, kuba, mptcp

From: Paolo Abeni <pabeni@redhat.com>
Date: Wed, 29 Apr 2020 12:50:37 +0200

> Fixes: 20882e2cb904 ("mptcp: avoid flipping mp_capable field in syn_recv_sock()")

[davem@localhost net]$ git describe 20882e2cb904
fatal: Not a valid object name 20882e2cb904
[davem@localhost net]$ 

Please fix this.

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

* [MPTCP] Re: [PATCH net] mptcp: fix uninitialized value access
  2020-04-29 18:56 ` David Miller
@ 2020-04-30  8:46 ` Paolo Abeni
  -1 siblings, 0 replies; 6+ messages in thread
From: Paolo Abeni @ 2020-04-30  8:46 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 540 bytes --]

hi,

On Wed, 2020-04-29 at 11:56 -0700, David Miller wrote:
> From: Paolo Abeni <pabeni(a)redhat.com>
> Date: Wed, 29 Apr 2020 12:50:37 +0200
> 
> > Fixes: 20882e2cb904 ("mptcp: avoid flipping mp_capable field in syn_recv_sock()")
> 
> [davem(a)localhost net]$ git describe 20882e2cb904
> fatal: Not a valid object name 20882e2cb904
> [davem(a)localhost net]$ 
> 
> Please fix this.

Thank you for double checking! 

I'm sorry, I dumbly used my local hash instead of the the '-net' one
I'll send a v2!

Cheers,

Paolo

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

* Re: [PATCH net] mptcp: fix uninitialized value access
@ 2020-04-30  8:46 ` Paolo Abeni
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Abeni @ 2020-04-30  8:46 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, mathew.j.martineau, matthieu.baerts, kuba, mptcp

hi,

On Wed, 2020-04-29 at 11:56 -0700, David Miller wrote:
> From: Paolo Abeni <pabeni@redhat.com>
> Date: Wed, 29 Apr 2020 12:50:37 +0200
> 
> > Fixes: 20882e2cb904 ("mptcp: avoid flipping mp_capable field in syn_recv_sock()")
> 
> [davem@localhost net]$ git describe 20882e2cb904
> fatal: Not a valid object name 20882e2cb904
> [davem@localhost net]$ 
> 
> Please fix this.

Thank you for double checking! 

I'm sorry, I dumbly used my local hash instead of the the '-net' one
I'll send a v2!

Cheers,

Paolo


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

end of thread, other threads:[~2020-04-30  8:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 10:50 [MPTCP] [PATCH net] mptcp: fix uninitialized value access Paolo Abeni
2020-04-29 10:50 ` Paolo Abeni
2020-04-29 18:56 [MPTCP] " David Miller
2020-04-29 18:56 ` David Miller
2020-04-30  8:46 [MPTCP] " Paolo Abeni
2020-04-30  8:46 ` Paolo Abeni

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.