netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sock_diag: fix autoloading of the raw_diag module
@ 2018-11-05  6:37 Andrei Vagin
  2018-11-05  7:12 ` Cyrill Gorcunov
  2018-11-06  1:10 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Andrei Vagin @ 2018-11-05  6:37 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Andrei Vagin, Cyrill Gorcunov, Xin Long

IPPROTO_TCP isn't registred as an inet protocol, so
inet_protos[protocol] is always NULL for it.

Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Xin Long <lucien.xin@gmail.com>
Fixes: bf2ae2e4bf93 ("sock_diag: request _diag module only when the family or proto has been registered")
Signed-off-by: Andrei Vagin <avagin@gmail.com>
---
 net/core/sock.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/sock.c b/net/core/sock.c
index 6fcc4bc07d19..080a880a1761 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -3279,6 +3279,7 @@ int sock_load_diag_module(int family, int protocol)
 
 #ifdef CONFIG_INET
 	if (family == AF_INET &&
+	    protocol != IPPROTO_RAW &&
 	    !rcu_access_pointer(inet_protos[protocol]))
 		return -ENOENT;
 #endif
-- 
2.17.2

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

* Re: [PATCH] sock_diag: fix autoloading of the raw_diag module
  2018-11-05  6:37 [PATCH] sock_diag: fix autoloading of the raw_diag module Andrei Vagin
@ 2018-11-05  7:12 ` Cyrill Gorcunov
  2018-11-05 18:22   ` Cyrill Gorcunov
  2018-11-06  1:10 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Cyrill Gorcunov @ 2018-11-05  7:12 UTC (permalink / raw)
  To: Andrei Vagin; +Cc: David S. Miller, netdev, Xin Long

On Sun, Nov 04, 2018 at 10:37:15PM -0800, Andrei Vagin wrote:
> IPPROTO_TCP isn't registred as an inet protocol, so
> inet_protos[protocol] is always NULL for it.

Typo, IPPROTO_RAW

> 
> Cc: Cyrill Gorcunov <gorcunov@gmail.com>
> Cc: Xin Long <lucien.xin@gmail.com>
> Fixes: bf2ae2e4bf93 ("sock_diag: request _diag module only when the family or proto has been registered")
> Signed-off-by: Andrei Vagin <avagin@gmail.com>
> ---
>  net/core/sock.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/core/sock.c b/net/core/sock.c
> index 6fcc4bc07d19..080a880a1761 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -3279,6 +3279,7 @@ int sock_load_diag_module(int family, int protocol)
>  
>  #ifdef CONFIG_INET
>  	if (family == AF_INET &&
> +	    protocol != IPPROTO_RAW &&
>  	    !rcu_access_pointer(inet_protos[protocol]))
>  		return -ENOENT;
>  #endif

Andrew, looking into kernel code I wonder, maybe we should simply
add this protocol into inet_protos during net/ipv4/af_inet.c:inet_init?
It will require to add netns_ok into raw_prot of course.

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

* Re: [PATCH] sock_diag: fix autoloading of the raw_diag module
  2018-11-05  7:12 ` Cyrill Gorcunov
@ 2018-11-05 18:22   ` Cyrill Gorcunov
  0 siblings, 0 replies; 4+ messages in thread
From: Cyrill Gorcunov @ 2018-11-05 18:22 UTC (permalink / raw)
  To: Andrei Vagin; +Cc: David S. Miller, netdev, Xin Long

On Mon, Nov 05, 2018 at 10:12:34AM +0300, Cyrill Gorcunov wrote:
> 
> Andrew, looking into kernel code I wonder, maybe we should simply
> add this protocol into inet_protos during net/ipv4/af_inet.c:inet_init?
> It will require to add netns_ok into raw_prot of course.

After spending some time on this idea I think your patch is better,
since it is small and suitable for a -stable fix (because the former
issue is definitely changing the kernel behaviour, the fix should
be passed to -stable as well).

Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>

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

* Re: [PATCH] sock_diag: fix autoloading of the raw_diag module
  2018-11-05  6:37 [PATCH] sock_diag: fix autoloading of the raw_diag module Andrei Vagin
  2018-11-05  7:12 ` Cyrill Gorcunov
@ 2018-11-06  1:10 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2018-11-06  1:10 UTC (permalink / raw)
  To: avagin; +Cc: netdev, gorcunov, lucien.xin

From: Andrei Vagin <avagin@gmail.com>
Date: Sun,  4 Nov 2018 22:37:15 -0800

> IPPROTO_TCP isn't registred as an inet protocol, so
> inet_protos[protocol] is always NULL for it.
> 
> Cc: Cyrill Gorcunov <gorcunov@gmail.com>
> Cc: Xin Long <lucien.xin@gmail.com>
> Fixes: bf2ae2e4bf93 ("sock_diag: request _diag module only when the family or proto has been registered")
> Signed-off-by: Andrei Vagin <avagin@gmail.com>

Applied and queued up for -stable.

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

end of thread, other threads:[~2018-11-06 10:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-05  6:37 [PATCH] sock_diag: fix autoloading of the raw_diag module Andrei Vagin
2018-11-05  7:12 ` Cyrill Gorcunov
2018-11-05 18:22   ` Cyrill Gorcunov
2018-11-06  1:10 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).