Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp646065imu; Thu, 13 Dec 2018 01:53:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/W67t+mhOVwCYtuzZ5qpdaVeBCAJjXm0viNPKqzvSEFgUBuMHSRQ/qIXPFTElEoKZXFcmqc X-Received: by 2002:a62:4181:: with SMTP id g1mr23338247pfd.45.1544694797382; Thu, 13 Dec 2018 01:53:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544694797; cv=none; d=google.com; s=arc-20160816; b=IE8yMO+NEASILQi5rpfAtRWiooB3LrdQFKP/Zb+b3q5vAwP70N2kmkDOSRQKfbx/wB k3iyZLwkSBTh70qxvA2mFoQRYGLkO+dMtQuEKUPIyNNh84PTecHu2edAbhjT0Bkz6rNE A7yBUSXUcDGVBWMs/c7RZDRu4m8OoS0WSOwyC0NNchByAAuMhoQA+7dmq7ydekMkNbig ypC0QeqfE/RHdR+Bc8Bqesyptmxte0Pj1d0ibdWznITCXSW6M8sIlGzrVwVcRbFruDYU jdszPaGIPaW/mQ8fSj+tvRDKjY9lRi8XkPaqOcDYDD2RHYfLuCXlnPRKLhaYeKKUKEJf hScA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ezbHoWf80BLtCbUijBrlHvAIXH6La9Qg8eHy3jvz1Ec=; b=EOVzSUZHfUkInSBI4KsZL++GM4il5TFFm7X2YMmKvsib1y5GmqyyOHddfeXyyWnJxQ gGFbhSqoRCqGpEXctbdHadH0hd3gqO70fYdofo0U+68wVGKDHwWyGvCh2aMzgOC25594 by8pcIZCEcVgGVrsejDCBOM8nEKpTNnVPm+8oQtufQd09oO5xxOi44ff8Vgfp6eu5uFN s3V6RcFm4sCSHrFKTF+oMsq4Ji2RN77oDM7fqUmntsPqMKi96fMjTsbCz5PIPXU1LK7+ ur5ucBtLOGHER2L78NJ0GVLMYjos83ppnpS3wRygGPqserwC1KgE7+AEyytfS70TG2j9 sPzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gJPT08Ze; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11si1238192pgs.126.2018.12.13.01.53.02; Thu, 13 Dec 2018 01:53:17 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gJPT08Ze; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728118AbeLMJvC (ORCPT + 99 others); Thu, 13 Dec 2018 04:51:02 -0500 Received: from mail-io1-f67.google.com ([209.85.166.67]:37019 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727570AbeLMJvB (ORCPT ); Thu, 13 Dec 2018 04:51:01 -0500 Received: by mail-io1-f67.google.com with SMTP id f14so1107965iol.4; Thu, 13 Dec 2018 01:51:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ezbHoWf80BLtCbUijBrlHvAIXH6La9Qg8eHy3jvz1Ec=; b=gJPT08ZeREatQfB1fKpjZyEtVL1OD6wi2rDoSK97K2ICAbAzsJDG7EzbwYbh9yR5lM V3jNXHYLptW6duIC4LsFFZVcoRDTlBaOjrxaI30W6oXw1JFfjlE1JJX2clRpkkqqDpU7 Y6NEXKuQBxQmWnCiySmwyiSs7snNOdkh18qWm1dC27GnAze2uaBNdo99tmp3tUhWBoZy lK5ne1adYFTIwyuAgpa99c2Qa4HGHELLNc4dLhjQR83eqmX92BIXXsUHhAhloNU3l6xK Lr90OYb8WQVcmdx3Cw/WaVJOYiMFIa4gdxTkWvuVPWeBuoZ/TaE8TukfQ/Q5SKc/HhSI +57w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ezbHoWf80BLtCbUijBrlHvAIXH6La9Qg8eHy3jvz1Ec=; b=fn0cGLUB33oCgOT807+pDn1cdjnCI3hJRrfT6VeMemOYc0/NsWpVQYJazgrDcJeLwz 5BoUJqs2m/rLfXsPsZUHn7igLQZqodXn6qkLg+NqfhJJCKOBx4w/tDOPFwfeBkpU3T7t UCuMelS2lGPzQRsQcyZsUUSMiYKrgpYMXUnsU7GAvBAnNebQmDpuAMSdJ/H7V5ezkl3V f6KEeG4Nsww3Rs9NJPJd1zBR5hnrwA85yutSHA9nlZ9XnHsC6QgbYWPitlGMf+J8rTin 9I77taYgAzmPOxwd+KtSKcTnmuPU+vQpfHwb1pars/Ae4snlRNnJETQPocfP1O4b/cCF 7apQ== X-Gm-Message-State: AA+aEWbEij3iWiqqpmA35E6TgmgysiQ4nkFWVANJldLhZ8Gwd73xAa58 nlkVwFRp8q711TAd2qKtlg0Xhic9pXzN9iA6S3g= X-Received: by 2002:a5e:db44:: with SMTP id r4mr17624992iop.142.1544694660615; Thu, 13 Dec 2018 01:51:00 -0800 (PST) MIME-Version: 1.0 References: <1544014590-14429-1-git-send-email-laoar.shao@gmail.com> <1544014590-14429-4-git-send-email-laoar.shao@gmail.com> <20181212232648.qsvyuc3g2jj5v2ej@salvia> In-Reply-To: <20181212232648.qsvyuc3g2jj5v2ej@salvia> From: Yafang Shao Date: Thu, 13 Dec 2018 17:50:23 +0800 Message-ID: Subject: Re: [PATCH 4/5] netfilter: fix missed NULL check in nf_conntrack_proto_pernet_init() To: pablo@netfilter.org Cc: kadlec@blackhole.kfki.hu, fw@strlen.de, David Miller , Alexey Dobriyan , Andrew Morton , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev , linux-fsdevel@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 13, 2018 at 7:26 AM Pablo Neira Ayuso wrote: > > 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. Got it. Thanks for your explanation. Thanks Yafang