Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1418331imm; Thu, 5 Jul 2018 23:02:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdrrhtHwagOfxOIfvuNz6ImcMbh9vFcgsAeYqKf/34tc/VtW3wrc+001CtGhAnjB4eUky85 X-Received: by 2002:a17:902:64c2:: with SMTP id y2-v6mr9000776pli.53.1530856977864; Thu, 05 Jul 2018 23:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530856977; cv=none; d=google.com; s=arc-20160816; b=xXjnsFRnoPRLgbS2Hvv9IPepy3KNqQok2k5tECwQSV06EOs7iVRCdMOrR7vZN+b+Wv I1ngMiNlYtoQJuTEZvlDoG6jLh64n8cbUpoUinHM9Wqjc7ghkkEJVr5KpIZkLf9hhgGj Vt70x1B+RqK11yBipCxseOQkWIIpW4zqpard2aHNTKaU1E1la77yGWZ5TLbe5B3Vdbo2 4x3UpFLObMeQKW5pZkdXGYATULSuaY9rX8qSn3+F4ugeJZqaucUYcqcSvNunqfuOaRFY nTYR3Qlz8mzzQoOk92kBaygyt5Uj2d93uveatVULqcWCcYHysFjTXICemP7WrD0yyntH +TJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=CbXkHMT2DsaKzDVTIwvRKdEUk6C+hGlTk3tysjAoYgg=; b=iFsx1pXwcf93p2ecI1c9Htyo4GNrRgHdLG/WFwSHu3CPtBf401j8Sggo0yKRiqCWXH BXcrHO6IKNgPMYTFXLblC+9iSkiiWEF56OndJw25oWlpEYD6SSej4dmzIN1vgQWSOuo1 xlZKtgHKgKe6Xu9LlJ+9rM6+aEcRzurV0AN00AEGGY/mfnBtBNz3+n+k6GsRvz1oT08c I9bLkUILvOxkx0H82XSPPnej1zQp+srP4uxam9dUp8NJIy2ewgQMw+fN+v5HHrY745WF RSgcMv9VLsrdiOtZc6C0o79ThBp9+LApxvRKXWDjl7r9I+ba4TOvvxWjZMeSICAZiqgN 1iBg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6-v6si6378271pgt.352.2018.07.05.23.02.43; Thu, 05 Jul 2018 23:02:57 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933960AbeGFFuk (ORCPT + 99 others); Fri, 6 Jul 2018 01:50:40 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60892 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933878AbeGFFui (ORCPT ); Fri, 6 Jul 2018 01:50:38 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4573186A; Fri, 6 Jul 2018 05:50:37 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 4.14 24/61] netfilter: nft_compat: prepare for indirect info storage Date: Fri, 6 Jul 2018 07:46:48 +0200 Message-Id: <20180706054713.263969548@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054712.332416244@linuxfoundation.org> References: <20180706054712.332416244@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal commit 8bdf164744b2c7f63561846c01cff3db597f282d upstream. Next patch will make it possible for *info to be stored in a separate allocation instead of the expr private area. This removes the 'expr priv area is info blob' assumption from the match init/destroy/eval functions. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nft_compat.c | 47 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c @@ -324,11 +324,11 @@ static int nft_target_validate(const str return 0; } -static void nft_match_eval(const struct nft_expr *expr, - struct nft_regs *regs, - const struct nft_pktinfo *pkt) +static void __nft_match_eval(const struct nft_expr *expr, + struct nft_regs *regs, + const struct nft_pktinfo *pkt, + void *info) { - void *info = nft_expr_priv(expr); struct xt_match *match = expr->ops->data; struct sk_buff *skb = pkt->skb; bool ret; @@ -352,6 +352,13 @@ static void nft_match_eval(const struct } } +static void nft_match_eval(const struct nft_expr *expr, + struct nft_regs *regs, + const struct nft_pktinfo *pkt) +{ + __nft_match_eval(expr, regs, pkt, nft_expr_priv(expr)); +} + static const struct nla_policy nft_match_policy[NFTA_MATCH_MAX + 1] = { [NFTA_MATCH_NAME] = { .type = NLA_NUL_STRING }, [NFTA_MATCH_REV] = { .type = NLA_U32 }, @@ -412,10 +419,10 @@ static void match_compat_from_user(struc } static int -nft_match_init(const struct nft_ctx *ctx, const struct nft_expr *expr, - const struct nlattr * const tb[]) +__nft_match_init(const struct nft_ctx *ctx, const struct nft_expr *expr, + const struct nlattr * const tb[], + void *info) { - void *info = nft_expr_priv(expr); struct xt_match *match = expr->ops->data; struct xt_mtchk_param par; size_t size = XT_ALIGN(nla_len(tb[NFTA_MATCH_INFO])); @@ -444,11 +451,18 @@ nft_match_init(const struct nft_ctx *ctx return 0; } +static int +nft_match_init(const struct nft_ctx *ctx, const struct nft_expr *expr, + const struct nlattr * const tb[]) +{ + return __nft_match_init(ctx, expr, tb, nft_expr_priv(expr)); +} + static void -nft_match_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) +__nft_match_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr, + void *info) { struct xt_match *match = expr->ops->data; - void *info = nft_expr_priv(expr); struct xt_mtdtor_param par; par.net = ctx->net; @@ -462,9 +476,15 @@ nft_match_destroy(const struct nft_ctx * module_put(match->me); } -static int nft_match_dump(struct sk_buff *skb, const struct nft_expr *expr) +static void +nft_match_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) +{ + __nft_match_destroy(ctx, expr, nft_expr_priv(expr)); +} + +static int __nft_match_dump(struct sk_buff *skb, const struct nft_expr *expr, + void *info) { - void *info = nft_expr_priv(expr); struct xt_match *match = expr->ops->data; if (nla_put_string(skb, NFTA_MATCH_NAME, match->name) || @@ -478,6 +498,11 @@ nla_put_failure: return -1; } +static int nft_match_dump(struct sk_buff *skb, const struct nft_expr *expr) +{ + return __nft_match_dump(skb, expr, nft_expr_priv(expr)); +} + static int nft_match_validate(const struct nft_ctx *ctx, const struct nft_expr *expr, const struct nft_data **data)