[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1386176630.30495.110.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Wed, 04 Dec 2013 09:03:50 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Jamal Hadi Salim <jhs@...atatu.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org,
alexander.h.duyck@...el.com, ebiederm@...ssion.com
Subject: Re: [PATCH 1/5] net_sched: Fail if missing mandatory action
operation methods
On Wed, 2013-12-04 at 09:26 -0500, Jamal Hadi Salim wrote:
> Signed-off-by: Jamal Hadi Salim <jhs@...atatu.com>
> ---
> net/sched/act_api.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/net/sched/act_api.c b/net/sched/act_api.c
> index fd70728..618695e 100644
> --- a/net/sched/act_api.c
> +++ b/net/sched/act_api.c
> @@ -270,6 +270,10 @@ int tcf_register_action(struct tc_action_ops *act)
> {
> struct tc_action_ops *a, **ap;
>
> + /* Must supply act, dump, cleanup and init */
> + if (!act->act || !act->dump || !act->cleanup || !act->init)
> + return -EINVAL;
> +
> write_lock(&act_mod_lock);
> for (ap = &act_base; (a = *ap) != NULL; ap = &a->next) {
> if (act->type == a->type || (strcmp(act->kind, a->kind) == 0)) {
> @@ -381,7 +385,7 @@ int tcf_action_exec(struct sk_buff *skb, const struct tc_action *act,
> }
> while ((a = act) != NULL) {
> repeat:
> - if (a->ops && a->ops->act) {
> + if (a->ops) {
Could we remove all these tests on a->ops being NULL or not ?
IMHO a->ops cannot be NULL. If NULL, just crash by NULL deref.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists