netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Simon Horman <simon.horman@netronome.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH/RFC rocker-net-next 2/6] net: flow: Handle error when putting a field while putting a flow
Date: Mon, 05 Jan 2015 09:28:14 -0800	[thread overview]
Message-ID: <54AAC9AE.4010104@gmail.com> (raw)
In-Reply-To: <1420440610-20621-3-git-send-email-simon.horman@netronome.com>

On 01/04/2015 10:50 PM, Simon Horman wrote:
> Signed-off-by: Simon Horman <simon.horman@netronome.com>
> ---
>   net/core/flow_table.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/flow_table.c b/net/core/flow_table.c
> index 2af831e..753ebe0 100644
> --- a/net/core/flow_table.c
> +++ b/net/core/flow_table.c
> @@ -981,8 +981,9 @@ done:
>
>   int net_flow_put_flow(struct sk_buff *skb, struct net_flow_flow *flow)
>   {
> -	struct nlattr *flows, *matches;
> +	struct nlattr *flows;
>   	struct nlattr *actions = NULL; /* must be null to unwind */
> +	struct nlattr *matches = NULL; /* must be null to unwind */

Actually we don't need to initialize to NULL now. That was some crazy
unwind scheme I had in place initially.

Now we only ever do a nla_nest_cancel on nested attributes that have
been initialized with nla_nest_start(). So I can simplify this to

	struct nlattr *flows, *matches, *actions;

>   	int err, j, i = 0;
>
>   	flows = nla_nest_start(skb, NET_FLOW_FLOW);
> @@ -1005,7 +1006,11 @@ int net_flow_put_flow(struct sk_buff *skb, struct net_flow_flow *flow)
>   			if (!f->header)
>   				continue;
>
> -			nla_put(skb, NET_FLOW_FIELD_REF, sizeof(*f), f);
> +			err = nla_put(skb, NET_FLOW_FIELD_REF, sizeof(*f), f);

Great thanks. I missed this one.

> +			if (err) {
> +				nla_nest_cancel(skb, matches);
> +				goto flows_put_failure;
> +			}
>   		}
>   		nla_nest_end(skb, matches);
>   	}
>

I'll fold this into the series and resubmit thanks.

.John

-- 
John Fastabend         Intel Corporation

  reply	other threads:[~2015-01-05 17:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05  6:50 [PATCH/RFC rocker-net-next 0/6] net: flow: Minor fixes and cleanups Simon Horman
2015-01-05  6:50 ` [PATCH/RFC rocker-net-next 1/6] net: flow: Cancel innermost nested attribute first Simon Horman
2015-01-05 21:17   ` David Miller
2015-01-05 22:01     ` Thomas Graf
2015-01-05 22:10       ` David Miller
2015-01-06  1:03     ` Simon Horman
2015-01-05  6:50 ` [PATCH/RFC rocker-net-next 2/6] net: flow: Handle error when putting a field while putting a flow Simon Horman
2015-01-05 17:28   ` John Fastabend [this message]
2015-01-06  1:04     ` Simon Horman
2015-01-05  6:50 ` [PATCH/RFC rocker-net-next 3/6] net: flow: Remove unnecessary zero-header check when " Simon Horman
2015-01-05  6:50 ` [PATCH/RFC rocker-net-next 4/6] net: flow: free action args Simon Horman
2015-01-05  6:50 ` [PATCH/RFC rocker-net-next 5/6] net: flow: Return more fine-grained error when handing flows commands Simon Horman
2015-01-05  6:50 ` [PATCH/RFC rocker-net-next 6/6] net: flow: Limit checking of ndo_flow_{set,del}_flows Simon Horman
2015-01-05 17:32   ` John Fastabend
2015-01-06  1:07     ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54AAC9AE.4010104@gmail.com \
    --to=john.fastabend@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=simon.horman@netronome.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).