net: cls_u32: catch all hardware offload errors

Errors reported by u32_replace_hw_hnode() were not propagated.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jakub Kicinski 2016-06-08 20:11:03 +01:00 committed by David S. Miller
parent 3497ed8c85
commit 6eef3801e7
1 changed files with 7 additions and 1 deletions

View File

@ -922,11 +922,17 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
ht->divisor = divisor;
ht->handle = handle;
ht->prio = tp->prio;
err = u32_replace_hw_hnode(tp, ht, flags);
if (err) {
kfree(ht);
return err;
}
RCU_INIT_POINTER(ht->next, tp_c->hlist);
rcu_assign_pointer(tp_c->hlist, ht);
*arg = (unsigned long)ht;
u32_replace_hw_hnode(tp, ht, flags);
return 0;
}