Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4901186rwb; Tue, 17 Jan 2023 06:58:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXva6xgKhvqkA4OuALQ3iSbSa0qknS96mCiM5RGiydIkE/C7fG5CMDPdDdsMLledstQY3M1Q X-Received: by 2002:a05:6402:4441:b0:49c:91d8:e989 with SMTP id o1-20020a056402444100b0049c91d8e989mr2978110edb.42.1673967480657; Tue, 17 Jan 2023 06:58:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673967480; cv=none; d=google.com; s=arc-20160816; b=GuJODOiSVUcJyd6DK9XXoYoGFNNL0wQZmOlBrE5zKNLu9PctMSnCbzoSiRnOVqPoMa wGEaAAp0OJQKqZQHlTb6wj60eiani2VhGaK0QnCTq9Hb4f0OsCi7NwMXPlrBNcHxOPbF Y3WfBUHzfEZVmxn4o9/1EnEaKcR2HT6VtH2rDPsHS4eBuFCvS4sbHvzMQ6hqWeDJHxTz vMLEZ4CMsgwgmVuT/Dykp5MIINTsCCuUucDth38D570IdGEL/Om9KB0LIMZ+3+dE7OjP 0lqb/1Q2h1NInoCw4JdfJZRGPG0m5rI/oz4GFIJ1GO6ndQzNApHFBx1fMYdEbwTBXzlj 4BsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=8Iw96WeS5KGYG5x9uDVIy/272FV3LrtuP2sOOg/trfs=; b=c9NGS9l3IumgkC1f3OuwzhxexR08j4cnpTranI7DtH21g19e1e56blxASVbvSTlWer N0Hs0TI7XYexBkR0HkKL2KOPvz77nCoqYwt6IQhGBjEyQgUslz8Ni6G+hQNo22j2QJP/ /21nFM+OB9pxathfqr0h/l5+XYJr96hk8kpIlKO0lqz8YivEQFlqT1c0rS+3Lt+OognF cQoNis7KTowKCl+M3weO4pXksK/Qnzd4pkePadOuFZEjYllHBLHDi1vqKGiosuhWHuAh q7g0esdKNPLeIPPgmO14KP/f8df9L+x87p2j6Rp//AsxYpoL6e6hh4T3VhY/p3pDYzOF +Iow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=wCYCBI8R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w5-20020a05640234c500b00499c3b58c13si10217434edc.7.2023.01.17.06.57.48; Tue, 17 Jan 2023 06:58:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=wCYCBI8R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229609AbjAQNqf (ORCPT + 48 others); Tue, 17 Jan 2023 08:46:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230032AbjAQNqC (ORCPT ); Tue, 17 Jan 2023 08:46:02 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C3E23B65B; Tue, 17 Jan 2023 05:45:44 -0800 (PST) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30HDYUoS031230; Tue, 17 Jan 2023 13:45:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2022-7-12; bh=8Iw96WeS5KGYG5x9uDVIy/272FV3LrtuP2sOOg/trfs=; b=wCYCBI8RjENRPfquR2+6KGAYC0vq3yy0Kj6MoK+eJJcOuDDiDwu/vjZZfNxuD8K3lHTR nhC6pWh/x5JWtaM63eyY7ml4nL270ZhCZvcjUy2PPj4cqOv1If3xERNRVxPcBY66BVlb yqRDuo5AIF6B+bY70W3/zO1/EM5DahUjBfnv6nkzJg5ITvth7rqfmnzI38pyzsPW5ioE FzSQvnG0C4WgRnpJd/9enurlVwulJ/dgObxbRfi5SSRg8atxnbNHstQojjKCK5UEGh1Z /YaxcgiehH6e26iyHo97acJEe4PEww3zlCbc2xJs9FUXdSxCOlMNb8OpumKBhiaVkI/z jQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3kaacs31-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jan 2023 13:45:44 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30HBubHa028533; Tue, 17 Jan 2023 13:45:42 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n4s2s2x1t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jan 2023 13:45:42 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 30HDjgFo035336; Tue, 17 Jan 2023 13:45:42 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3n4s2s2x17-1; Tue, 17 Jan 2023 13:45:42 +0000 From: Alok Tiwari To: linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org Cc: alok.a.tiwari@oracle.com Subject: [PATCH 6.1] netfilter: Null pointer dereference in nf_tables_updobj Date: Tue, 17 Jan 2023 05:45:38 -0800 Message-Id: <20230117134537.3400252-1-alok.a.tiwari@oracle.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-17_06,2023-01-17_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301170113 X-Proofpoint-GUID: _lOYdg1GqhRekgkNlZor22TIMk_yUzF_ X-Proofpoint-ORIG-GUID: _lOYdg1GqhRekgkNlZor22TIMk_yUzF_ X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org static analyzer detect null pointer dereference case for 'type' function __nft_obj_type_get() can return NULL value which require to handle if type is NULL pointer return -ENOENT Signed-off-by: Alok Tiwari --- net/netfilter/nf_tables_api.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 3ba8c291fcaa..e20f1de1c216 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -6951,6 +6951,9 @@ static int nf_tables_newobj(struct sk_buff *skb, const struct nfnl_info *info, return -EOPNOTSUPP; type = __nft_obj_type_get(objtype); + if (!WARN_ON_ONCE(type)) + return -ENOENT; + nft_ctx_init(&ctx, net, skb, info->nlh, family, table, NULL, nla); return nf_tables_updobj(&ctx, type, nla[NFTA_OBJ_DATA], obj); -- 2.38.1