Skip to content

Commit

Permalink
datapath: add skb_clone NULL check in the recirc action.
Browse files Browse the repository at this point in the history
Refactoring recirc action implementation.

The main change is to fix a bug where the NULL check after skb clone()
call is missing.  The fix is to return -ENOMEM whenever skb_clone()
failed to create a clone.

Also rearranged adjacent code to improve readability.

Reported-by: Pravin B Shelar <[email protected]>
Signed-off-by: Andy Zhou <[email protected]>
Acked-by: Pravin B Shelar <[email protected]>
  • Loading branch information
azhou-nicira committed Jul 10, 2014
1 parent aa359b5 commit 37dfe52
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions datapath/actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,15 +729,17 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
case OVS_ACTION_ATTR_RECIRC: {
struct sk_buff *recirc_skb;

if (!last_action(a, rem))
recirc_skb = skb_clone(skb, GFP_ATOMIC);
else
recirc_skb = skb;
if (last_action(a, rem))
return execute_recirc(dp, skb, a);

err = execute_recirc(dp, recirc_skb, a);
/* Recirc action is the not the last action
* of the action list. */
recirc_skb = skb_clone(skb, GFP_ATOMIC);

if (recirc_skb == skb)
return err;
/* Skip the recirc action when out of memory, but
* continue on with the rest of the action list. */
if (recirc_skb)
err = execute_recirc(dp, recirc_skb, a);

break;
}
Expand Down

0 comments on commit 37dfe52

Please sign in to comment.