Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9438921imu; Wed, 5 Dec 2018 04:58:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xe/8QAYIQNVTChdDjJB8UJoMFIbPxYyACgRWVwsdtmy9g11uFPNcr+8kmElrqOvYBKVnWq X-Received: by 2002:a17:902:4124:: with SMTP id e33mr24062423pld.236.1544014723354; Wed, 05 Dec 2018 04:58:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544014723; cv=none; d=google.com; s=arc-20160816; b=sBd75ouk2JiC9QdzWBvqRtZ93ZEind0ae3uCofYOZIQmkJH5rj3nIZAqS2+5RcFp0Z FvPA4/HEyXA+VjjDkqWJWa0AADSqe5VPE2BdhoZKrSBBdm6jmAKMWRU4+I+qpqRM6OoD RGsGXLkWteID7KijFIByJBrVGlj+426Sj4UKE/zhC2TfAV7layeSH0pUY5c8BZ4e98VI C2w66K2KdIJUrQAyMpgKXzHtbkP0zNVcIAalrDNWXgfSBuSBcu6pFYUG7Ged972iyDgN nP+NhLwJ5zFpmR4cnmRgfekByKB2OGPJ4Bok7c6bCnwykwZYzlj066sKuA+2CHBaqV1A HToQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=kPHdydhUX9ooSL0A7ozYYgMZy1PB7bQSzbcoXLKwK5U=; b=m4sgJg+pogiKwbdHNdDIcC+e00KCsfozxpRQO3yw+KTEMXC57IYCpJc8Py7LRzmugO f9TU/soqWZ5HOcJnXa0Cfs1Uw65YSCDxBqDYNdtOdZ8QtlG2iinfdU2zy9zzt3AtonhV nRHnoYSM+hBIo7s+lsfEOjvpxiEh1KWvU5/uHeJLxZFyF/OoDNbgazjivOF1/QLVRESA itIMcPAP5tEp5Thp1XO3qDjxTjBWg9xxS/vM9LbizletZgmdh6blGoEaSLzGeN022ydG NLA33KDdoK1iMRUfxR/eGxNsoWmw4G8Wsewagh3LSkUcWTvYlfDTeRQgwxJEgJHT44YK j0qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UzVT7tLi; 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 v83si21551406pfk.264.2018.12.05.04.58.28; Wed, 05 Dec 2018 04:58:43 -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=UzVT7tLi; 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 S1728051AbeLEM5i (ORCPT + 99 others); Wed, 5 Dec 2018 07:57:38 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:38683 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727475AbeLEM5f (ORCPT ); Wed, 5 Dec 2018 07:57:35 -0500 Received: by mail-pg1-f193.google.com with SMTP id g189so8991640pgc.5; Wed, 05 Dec 2018 04:57:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kPHdydhUX9ooSL0A7ozYYgMZy1PB7bQSzbcoXLKwK5U=; b=UzVT7tLiPj86PGmIAVOEqyGKY4cumawAuv4qlDoOYPvYY1Ci/JActq6uXPg7OtN3nr qc3pVY6EBNzTFW0/srnC+q5BX9j/jlMTkDvD3mlCyouVb0cZzH8tEaCsQoXsj89zsJIn bdWPBmHBded8Tza6p/ozEh2bxGDBFnf8NRFiuP0H9tIDb7X+zfAcOqz4LQRjInBeY42A P6JJ9LMHVojgZgqlbFMGrndLBhWgGJAscfwIF7mCtFK1m3etHnicLzfOa0WlHSOAvlC6 aNGjEu/7J65lf2TRPpSWlZARXhYQ7PpxVX2WHiJjF1bd2bQSoQW82fOibZfnb8LW+R8t LCRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kPHdydhUX9ooSL0A7ozYYgMZy1PB7bQSzbcoXLKwK5U=; b=B17BMEu3RrFtkxzyz/p9BqUe52GjxO5noMOFWYPCWsC2ox37+wkrXIBmgOsaKedWHT kmhXnmcPqHl8/4WIvpA7djCvvbrEs6wfoZRE5YW0MZ1obt55nEDSgJzaWMZqOm2UCUcn MrfSVpXgODegA8UEbzSryE9X2Wle+QfufgwUVOjqAfumL8N6xxYYblAjs0G5FRNTQnLZ rIU59mZnjM3AXNubVaELcMSwFApbwyi6Dibf2PROg66z/VFSHwfUjpUANJFILUp1A73S N3phMx0Rt1+1SiAmb1/GXJ74fFwGB3ol6uW2MGetIwsirbe2pRPoG47Fx8E7mwGRl5Tx sODQ== X-Gm-Message-State: AA+aEWb52kdwVp9uBhJs0FDhFUV2WZQ2Ka+fU7vhAp6I5bBkeD/YzoZW Tm1mXTEQJC/2PMrgHjhF5Ag= X-Received: by 2002:a63:e516:: with SMTP id r22mr20818726pgh.256.1544014655165; Wed, 05 Dec 2018 04:57:35 -0800 (PST) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id q1sm26348898pfb.96.2018.12.05.04.57.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 04:57:34 -0800 (PST) From: Yafang Shao To: pablo@netfilter.org, kadlec@blackhole.kfki.hu, fw@strlen.de, davem@davemloft.net, adobriyan@gmail.com, akpm@linux-foundation.org Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Yafang Shao Subject: [PATCH 5/5] netfilter: fix error return value of nf_ct_l4proto_pernet_register_one() Date: Wed, 5 Dec 2018 20:56:30 +0800 Message-Id: <1544014590-14429-5-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544014590-14429-1-git-send-email-laoar.shao@gmail.com> References: <1544014590-14429-1-git-send-email-laoar.shao@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If pn is NULL, it will return 0. That's not proper. We should return an error. Signed-off-by: Yafang Shao --- net/netfilter/nf_conntrack_proto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/netfilter/nf_conntrack_proto.c b/net/netfilter/nf_conntrack_proto.c index 316fef3..3caf137 100644 --- a/net/netfilter/nf_conntrack_proto.c +++ b/net/netfilter/nf_conntrack_proto.c @@ -252,6 +252,7 @@ int nf_ct_l4proto_pernet_register_one(struct net *net, goto out; } + ret = -EINVAL; pn = nf_ct_l4proto_net(net, l4proto); if (pn == NULL) goto out; -- 1.8.3.1