Skip to content

Commit

Permalink
netfilter: ctnetlink: fix missing locking while changing conntrack fr…
Browse files Browse the repository at this point in the history
…om nfqueue

Since 9cb0176 netfilter: add glue code to integrate nfnetlink_queue and
ctnetlink, we can modify the conntrack entry via nfnl_queue. However, the
change of the conntrack entry via nfnetlink_queue requires appropriate
locking to avoid concurrent updates.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Pablo Neira Ayuso committed Aug 14, 2012
1 parent f22eb25 commit 68e035c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/netfilter/nf_conntrack_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1896,10 +1896,15 @@ static int
ctnetlink_nfqueue_parse(const struct nlattr *attr, struct nf_conn *ct)
{
struct nlattr *cda[CTA_MAX+1];
int ret;

nla_parse_nested(cda, CTA_MAX, attr, ct_nla_policy);

return ctnetlink_nfqueue_parse_ct((const struct nlattr **)cda, ct);
spin_lock_bh(&nf_conntrack_lock);
ret = ctnetlink_nfqueue_parse_ct((const struct nlattr **)cda, ct);
spin_unlock_bh(&nf_conntrack_lock);

return ret;
}

static struct nfq_ct_hook ctnetlink_nfqueue_hook = {
Expand Down

0 comments on commit 68e035c

Please sign in to comment.