From patchwork Tue Nov 15 12:56:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13043647 X-Patchwork-Delegate: kuba@kernel.org 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 E75E0C43219 for ; Tue, 15 Nov 2022 12:56:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237872AbiKOM4H (ORCPT ); Tue, 15 Nov 2022 07:56:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231178AbiKOM4G (ORCPT ); Tue, 15 Nov 2022 07:56:06 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9734F2C7; Tue, 15 Nov 2022 04:56:05 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id bs21so24112277wrb.4; Tue, 15 Nov 2022 04:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:date:from :from:to:cc:subject:date:message-id:reply-to; bh=8Suc+sDOw9njkbA6lorcFP1RSCMU5Z1RLuQ/KM9dn4E=; b=SgaeOd/CGA1rG+IGWVCNAzIArtZKPNHDEp26333K2hiCIWuZK0fNiyXHLKeYtb5NSe 10CGzkbG948ccpsZdTedmzA2sHcADEuCwNlhZUEx0BCT+KLEeVC7xbaCEmuUhchv+g7p CURG8lFHKQrNGkTCIcBAfBawEfwDm8HIfPLvDOuJ2B7WI9ykxg4oCdpYQSWp5r7ngKNL gmfU9eSE8oAu6YDlgap9jEu1zH+dumW4dK+VjV9HV4yOfWLSGA5Zc0dhB1d1sM0URsR2 bIpz6szMTAkUAaSMfED0YW7eiaGY2+kfqJjK8UYI9Nk1s/42spCHNurN4pSrbWHRLi4X QI+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8Suc+sDOw9njkbA6lorcFP1RSCMU5Z1RLuQ/KM9dn4E=; b=E7EBgIKWmt9oew0UWDxE13xCAFGZw3pRS3L7pwmrf/XkUJUeEP8tF09mOp5WXX298j PGYrX5wHhj303F1gCDn/SdXPugEPV9vVUewTgN9E9PHB0MFexnVBwN6Q1HEKFtMACxp5 Gg8BUl8o+8PYhgcTni9lYOP/R9mH9i3xY8SN5R5gmFEGqQyWf2dgrR+bYEZMbhqGQt4S 3rM2+nGjUCkvpITdkde2YL0XIXJJQ5FKUBzYIKlUVeKRrPnr65t4t5Ay2pybDGFwyK4a ymTchazjNREjAD2JabNcokdOMZ0u1qbWT/cIOVQA0BIRuEIl38SS25OfkxLXN7b/jK5M Tfrw== X-Gm-Message-State: ANoB5pk6S1nTIisNy881LKD8lGN2lOrw87PtxDY04qhkOJ/ZpPjH4O1t q7yapDqHLvN0dCmDuRvN/x0= X-Google-Smtp-Source: AA0mqf6LXGbMOdPES8+MrqVJoYnqb/iq4AENQu0yOdbYTfhxUcPgm3h/DU8Qxhdpm2V/pYdxUVOxwA== X-Received: by 2002:a5d:4cd0:0:b0:236:757c:54a1 with SMTP id c16-20020a5d4cd0000000b00236757c54a1mr10665635wrt.106.1668516964004; Tue, 15 Nov 2022 04:56:04 -0800 (PST) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id v21-20020a05600c215500b003c6c3fb3cf6sm15168301wml.18.2022.11.15.04.56.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 04:56:03 -0800 (PST) From: Dan Carpenter X-Google-Original-From: Dan Carpenter Date: Tue, 15 Nov 2022 15:56:00 +0300 To: Pablo Neira Ayuso Cc: Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH net-next/netfilter] netfilter: nft_inner: fix IS_ERR() vs NULL check Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The __nft_expr_type_get() function returns NULL on error. It never returns error pointers. Fixes: 3a07327d10a0 ("netfilter: nft_inner: support for inner tunnel header matching") Signed-off-by: Dan Carpenter --- This applies to net-next but presumably it's going to go through the netfilter tree? net/netfilter/nf_tables_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 62da204eed41..6b159494c86b 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -2873,8 +2873,8 @@ int nft_expr_inner_parse(const struct nft_ctx *ctx, const struct nlattr *nla, return -EINVAL; type = __nft_expr_type_get(ctx->family, tb[NFTA_EXPR_NAME]); - if (IS_ERR(type)) - return PTR_ERR(type); + if (!type) + return -ENOENT; if (!type->inner_ops) return -EOPNOTSUPP;