netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: jhs@mojatatu.com
Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com,
	alexander.h.duyck@intel.com, ebiederm@xmission.com
Subject: Re: [PATCH 5/5] net_sched: Fail if missing mandatory action operation methods
Date: Tue, 03 Dec 2013 11:48:34 -0500 (EST)	[thread overview]
Message-ID: <20131203.114834.106107332355850481.davem@davemloft.net> (raw)
In-Reply-To: <1386080600-4067-6-git-send-email-jhs@mojatatu.com>

From: Jamal Hadi Salim <jhs@mojatatu.com>
Date: Tue,  3 Dec 2013 09:23:19 -0500

> @@ -277,8 +277,10 @@ int tcf_register_action(struct tc_action_ops *act)
>  			return -EEXIST;
>  		}
>  	}
> -	act->next = NULL;
> -	*ap = act;
> +
> +	/* Must supply act, dump, cleanup and init */
> +	if (!act->act || !act->dump || !act->cleanup || !act->init)
> +		return -EINVAL;
>  
>  	/* Supply defaults */
>  	if (!act->lookup)

You are going to return with a lock held on error here.

I was going to tell you not to do these fixups so late in the
function, inside of the write lock, there is no reason for it.

You should do all of this operation handling at the top of
the function, before the write lock is taken.

  reply	other threads:[~2013-12-03 16:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 14:23 [PATCH 0/5] net_sched: actions - Add default lookup and walker Jamal Hadi Salim
2013-12-03 14:23 ` [PATCH 1/5] net_sched: Default action lookup method for actions Jamal Hadi Salim
2013-12-03 14:23 ` [PATCH 2/5] net_sched: Use default action lookup functions Jamal Hadi Salim
2013-12-03 14:23 ` [PATCH 3/5] net_sched: Provide default walker function for actions Jamal Hadi Salim
2013-12-03 14:23 ` [PATCH 4/5] net_sched: Use default action walker methods Jamal Hadi Salim
2013-12-03 14:23 ` [PATCH 5/5] net_sched: Fail if missing mandatory action operation methods Jamal Hadi Salim
2013-12-03 16:48   ` David Miller [this message]
2013-12-04  0:43     ` Jamal Hadi Salim
2013-12-04  4:04       ` David Miller
2013-12-04  4:05       ` David Miller

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=20131203.114834.106107332355850481.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=alexander.h.duyck@intel.com \
    --cc=ebiederm@xmission.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    /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).