Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 236631
b: refs/heads/master
c: 06cdb63
h: refs/heads/master
i:
  236629: dea6c5b
  236627: 8e4fb17
  236623: 8cfc8b9
v: v3
  • Loading branch information
Florian Westphal authored and Patrick McHardy committed Jan 18, 2011
1 parent 883d539 commit 18a700a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f15850861860636c905b33a9a5be3dcbc2b0d56a
refs/heads/master: 06cdb6349c1f3fd439398dbc04ce4c696f0a41ab
7 changes: 5 additions & 2 deletions trunk/net/netfilter/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,11 @@ int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
} else if ((verdict & NF_VERDICT_MASK) == NF_QUEUE) {
ret = nf_queue(skb, elem, pf, hook, indev, outdev, okfn,
verdict >> NF_VERDICT_BITS);
if (ret == -ECANCELED)
goto next_hook;
if (ret < 0) {
if (ret == -ECANCELED)
goto next_hook;
kfree_skb(skb);
}
ret = 0;
}
rcu_read_unlock();
Expand Down
17 changes: 10 additions & 7 deletions trunk/net/netfilter/nf_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,8 @@ static int __nf_queue(struct sk_buff *skb,

/* If it's going away, ignore hook. */
if (!try_module_get(entry->elem->owner)) {
rcu_read_unlock();
kfree(entry);
return -ECANCELED;
status = -ECANCELED;
goto err_unlock;
}
/* Bump dev refs so they don't vanish while packet is out */
if (indev)
Expand Down Expand Up @@ -198,7 +197,6 @@ static int __nf_queue(struct sk_buff *skb,
err_unlock:
rcu_read_unlock();
err:
kfree_skb(skb);
kfree(entry);
return status;
}
Expand Down Expand Up @@ -229,7 +227,6 @@ int nf_queue(struct sk_buff *skb,
}

segs = skb_gso_segment(skb, 0);
kfree_skb(skb);
/* Does not use PTR_ERR to limit the number of error codes that can be
* returned by nf_queue. For instance, callers rely on -ECANCELED to mean
* 'ignore this hook'.
Expand All @@ -253,8 +250,11 @@ int nf_queue(struct sk_buff *skb,
segs = nskb;
} while (segs);

/* also free orig skb if only some segments were queued */
if (unlikely(err && queued))
err = 0;
if (err == 0)
kfree_skb(skb);
return err;
}

Expand Down Expand Up @@ -300,8 +300,11 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
err = __nf_queue(skb, elem, entry->pf, entry->hook,
entry->indev, entry->outdev, entry->okfn,
verdict >> NF_VERDICT_BITS);
if (err == -ECANCELED)
goto next_hook;
if (err < 0) {
if (err == -ECANCELED)
goto next_hook;
kfree_skb(skb);
}
break;
case NF_STOLEN:
default:
Expand Down

0 comments on commit 18a700a

Please sign in to comment.