From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyrill Gorcunov Subject: Re: [PATCH] sock_diag: fix autoloading of the raw_diag module Date: Mon, 5 Nov 2018 10:12:34 +0300 Message-ID: <20181105071234.GC2869@uranus.lan> References: <20181105063715.21639-1-avagin@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "David S. Miller" , netdev@vger.kernel.org, Xin Long To: Andrei Vagin Return-path: Received: from mail-lf1-f67.google.com ([209.85.167.67]:45794 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729121AbeKEQaw (ORCPT ); Mon, 5 Nov 2018 11:30:52 -0500 Received: by mail-lf1-f67.google.com with SMTP id b20so5322516lfa.12 for ; Sun, 04 Nov 2018 23:12:37 -0800 (PST) Content-Disposition: inline In-Reply-To: <20181105063715.21639-1-avagin@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: 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 > Cc: Xin Long > Fixes: bf2ae2e4bf93 ("sock_diag: request _diag module only when the family or proto has been registered") > Signed-off-by: Andrei Vagin > --- > 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.