Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp221394imu; Wed, 12 Dec 2018 15:27:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/XcQ7GAckjlAIB43c0NHFxV5G+ybikwtAzJKmN4amhCaj1+O+azXe8ngZxemyM5VLWRiZg2 X-Received: by 2002:a17:902:28aa:: with SMTP id f39mr21866646plb.297.1544657279604; Wed, 12 Dec 2018 15:27:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544657279; cv=none; d=google.com; s=arc-20160816; b=BtEeKnMvN5V9kKfVrrAQ9wZzYyLMOpaYgM4a0QZCpbwwIWkSMuJgG3/m7tfgT5NldC UZWDh77iuUwSlXbnRvNoWyKXdb+MEpo1caWui5eP8fW2JyYMVS8ijcCAqWvGKxQ7vJ6m z04zLki5iPXsPA700Cc2fqc+r2hvwZaJP5Rvmp94eMJgHqI+HAX+ZVjqVHC4Qbta6hND HVOsFBKrg1fDiMtvrw5E2CCB3a7WyvH9rRW6d8xnqhDVwgQBk6ZmjQopS0HXrqE/+hyf BjdCs9VbEEmx90Iqmy3mE3R6dqO4XrweuEmErkZNosb5S3PhIIhF0oEQgZkayF1VUxEo B26Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=KSgDQjEV7+OM8BzenMj6VGiLesYaP0YKxCErezSuwX8=; b=x5FJdsnCF/g83BfJoJ/CI5gc/8NfLV0s7yF/oWOcZ2ozYOvWPgr03/gUwbDxF6UNWK pj0GJ0x8TGUgfpfgEjmOknqIbIFYkrlDU3zFG2N7mimn0hYRJXRY4ZKjCrakKorZR8rt inLjKHgLslB4q1GktxqCHMN34HGurwD+63frVm2A1vHy+vP7fis5m8cqleU2nmu5hyaO 6TnFmIdJ+3ErvghgRipcWxEP8DizHbh39R8KpJkniZoAVEIhv2QDK9/iCQDQpc/hGNAq L2A/JXjbkSmU81VuGakws3SMUFGGw18QbSE61n2EfzcO4xvidb4HidIbE6oXIM+7j3tL Ag/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16si76322pff.272.2018.12.12.15.27.44; Wed, 12 Dec 2018 15:27:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727287AbeLLX0y (ORCPT + 99 others); Wed, 12 Dec 2018 18:26:54 -0500 Received: from mail.us.es ([193.147.175.20]:41744 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726337AbeLLX0x (ORCPT ); Wed, 12 Dec 2018 18:26:53 -0500 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id 4FFFEFF2CF for ; Thu, 13 Dec 2018 00:26:51 +0100 (CET) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id 3DEA8DA7A5 for ; Thu, 13 Dec 2018 00:26:51 +0100 (CET) Received: by antivirus1-rhel7.int (Postfix, from userid 99) id 2D4C3DA79C; Thu, 13 Dec 2018 00:26:51 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on antivirus1-rhel7.int X-Spam-Level: X-Spam-Status: No, score=-108.2 required=7.5 tests=ALL_TRUSTED,BAYES_50, SMTPAUTH_US2,USER_IN_WHITELIST autolearn=disabled version=3.4.1 Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id 43E63DA738; Thu, 13 Dec 2018 00:26:49 +0100 (CET) Received: from 192.168.1.97 (192.168.1.97) by antivirus1-rhel7.int (F-Secure/fsigk_smtp/550/antivirus1-rhel7.int); Thu, 13 Dec 2018 00:26:49 +0100 (CET) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int) Received: from us.es (sys.soleta.eu [212.170.55.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: 1984lsi) by entrada.int (Postfix) with ESMTPSA id 1C0924265A4C; Thu, 13 Dec 2018 00:26:49 +0100 (CET) Date: Thu, 13 Dec 2018 00:26:48 +0100 X-SMTPAUTHUS: auth mail.us.es From: Pablo Neira Ayuso To: Yafang Shao Cc: kadlec@blackhole.kfki.hu, fw@strlen.de, davem@davemloft.net, adobriyan@gmail.com, akpm@linux-foundation.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/5] netfilter: fix missed NULL check in nf_conntrack_proto_pernet_init() Message-ID: <20181212232648.qsvyuc3g2jj5v2ej@salvia> References: <1544014590-14429-1-git-send-email-laoar.shao@gmail.com> <1544014590-14429-4-git-send-email-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1544014590-14429-4-git-send-email-laoar.shao@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 05, 2018 at 08:56:29PM +0800, Yafang Shao wrote: > nf_ct_l4proto_net() may return NULL. > That may happens if some module forget to set both l4proto->get_net_proto > and l4proto->net_id. > We'd check the return value here, in case crash happens. > > Signed-off-by: Yafang Shao > --- > net/netfilter/nf_conntrack_proto.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/net/netfilter/nf_conntrack_proto.c b/net/netfilter/nf_conntrack_proto.c > index 154e8c0..316fef3 100644 > --- a/net/netfilter/nf_conntrack_proto.c > +++ b/net/netfilter/nf_conntrack_proto.c > @@ -946,6 +946,9 @@ int nf_conntrack_proto_pernet_init(struct net *net) > struct nf_proto_net *pn = nf_ct_l4proto_net(net, > &nf_conntrack_l4proto_generic); There is another spot missing in this file that is missing the check for NULL. We can probably simplify all this is we place the gre conntracker in the conntrack core, as it's been suggested already. It's the only one remaining as a module and it now supports for IPv6, so it's probably better follow that path.