From patchwork Tue Nov 15 13:26:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13043684 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 37438C433FE for ; Tue, 15 Nov 2022 13:26:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229986AbiKON0O (ORCPT ); Tue, 15 Nov 2022 08:26:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbiKON0N (ORCPT ); Tue, 15 Nov 2022 08:26:13 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAF621116B; Tue, 15 Nov 2022 05:26:12 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id l14so24247849wrw.2; Tue, 15 Nov 2022 05:26:12 -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:from:date :from:to:cc:subject:date:message-id:reply-to; bh=UkG9A5GEaL+iS91A1sP8f+OHFyccXyI/9fKl7gdZSI4=; b=lYC5JBRTM5eHKD6SMbbqo7rjWAdVHt8UX8yK3yeoJdAquX9842yoOmuh6Ksj3+V2Xx KVEHb/gU1xog5n1xXCS9ATcEiK4Hmw4comE9Ws9+2aiqXzujEhcuW5hTW1c1+2KeRksw I7mSyYzo+jECQNfFsMeK5TLPoq9uYJC7TiA+tU9AsCIQTdSwo677tmmnZHcglrK4YYe9 moF5uN8rA3NdjVJo5uk6lnj7Yc6ZhoKqjx2phIGeOAlqJQLavqYKd8dSmYRFNHkz4lB+ BW/hjj6RYrtMdhFJoiluvtWNu9Q+z7mqc8eQ0cajwY8gP5rVQVO5grFMom3rw/qYmwen VRGQ== 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:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UkG9A5GEaL+iS91A1sP8f+OHFyccXyI/9fKl7gdZSI4=; b=iSFrfPKU3QKYIbyyENYOtFkTVsIpfg0EX2IwBj4L/In5fzxPUMtF5ymFG+J54jgI+a CXHLeidM1KR78bOJhvl0L3RLccoIufps7MiUSHtePLGTWMrINAltS53dtryrREfuEqo1 XEVif2jD4tcVEIXKC2Oq0fT2q8TLmbMIGKxlsSkkhr+VNmN1FHxIhzVYYZjjahO+Ua8j BoRbHD9HDLYsPChHq8sgNYRaZLjn7omvX3dXf9f+mP5pp91LdCK2EKY1AlnIK/jaKRac PAWwGV/ZPK9yTRDbTcK045mYnhO9KBqpo5JsGzbcViKC76SzN1OO+YdMVVvQBUbFzcTf mU+A== X-Gm-Message-State: ANoB5pnB8NstQwyd8BlBRFxQEYRq4FEqXZGBVqRnU74vwd4lwXtFIn3O iTVKOTPWHQle4OT9xhkk3Gk= X-Google-Smtp-Source: AA0mqf65gfPaZvyGgF2Go0sorV/aS1Gnaa76RvR8QG13OhEGBZmfq+49ld6g7elY235WTkAGgSYn4g== X-Received: by 2002:adf:fc0a:0:b0:22d:6988:30de with SMTP id i10-20020adffc0a000000b0022d698830demr10613276wrr.186.1668518771269; Tue, 15 Nov 2022 05:26:11 -0800 (PST) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id r2-20020a5d6942000000b0022e47b57735sm12557498wrw.97.2022.11.15.05.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 05:26:10 -0800 (PST) Date: Tue, 15 Nov 2022 16:26:07 +0300 From: Dan Carpenter 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 X-Mailer: git-send-email haha only kidding 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;