From nobody Mon Sep 15 01:57:32 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7012AC6379F for ; Tue, 17 Jan 2023 15:49:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231995AbjAQPtQ (ORCPT ); Tue, 17 Jan 2023 10:49:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234902AbjAQPsg (ORCPT ); Tue, 17 Jan 2023 10:48:36 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED95A2365B; Tue, 17 Jan 2023 07:46:04 -0800 (PST) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30HFNpWB026875; Tue, 17 Jan 2023 15:46:03 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=zSjgq3b0TgT6zIQCuWV+P7yPrUfv+/hUNuOmO3lb0+c=; b=f9yehE4kmMHoKvdUt1ixvNR/fGul7MWYtcmpdl8RuBOhuXhWrXsfQ/sAtsAhsJCguIbx chJ5X0nHgcSYN4hjb2Jh9ZA1zJov8pidSerHqKTdFu+FLUVgwDct+Kpx7xOWNm9Wu7e6 gL5PXguSLIC/89E+SFgVyW3XOQznhvckZxU4GDeOc/11Ec+aXBCc676Q7xaqRLT4Muo7 vFri5WrKdCY+b5WoXkowLwIyGJSfvC+i5srVTPyAfgxyMtYLaFWXR35QZqhuGHSuhrZi l+VPcaZvOr7bG+HtoVd+/zinxXnfZpoknFCXH/qUpI7BtIbaWAcUCb/WEu83ndb4Fs5g wA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3medd3s9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jan 2023 15:46:02 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30HESZq9020693; Tue, 17 Jan 2023 15:46:02 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n4rq3ysqn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jan 2023 15:46:01 +0000 Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 30HFk1oH034461; Tue, 17 Jan 2023 15:46:01 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3n4rq3yspy-1; Tue, 17 Jan 2023 15:46:01 +0000 From: Alok Tiwari To: linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, pablo@netfilter.org Cc: alok.a.tiwari@oracle.com, darren.kenny@oracle.com Subject: [PATCH v2 6.1] netfilter: Null pointer dereference in nf_tables_updobj Date: Tue, 17 Jan 2023 07:45:49 -0800 Message-Id: <20230117154548.3403346-1-alok.a.tiwari@oracle.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301170126 X-Proofpoint-ORIG-GUID: TKWeLIC3TPLVENij9jJG7UAG1QTgMMzt X-Proofpoint-GUID: TKWeLIC3TPLVENij9jJG7UAG1QTgMMzt Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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..dca5352bdf3d 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, cons= t struct nfnl_info *info, return -EOPNOTSUPP; =20 type =3D __nft_obj_type_get(objtype); + if (WARN_ON_ONCE(!type)) + return -ENOENT; + nft_ctx_init(&ctx, net, skb, info->nlh, family, table, NULL, nla); =20 return nf_tables_updobj(&ctx, type, nla[NFTA_OBJ_DATA], obj); --=20 2.38.1