Skip to content

Commit c43c5f3

Browse files
committed
Merge branch 'nf' of git://1984.lsi.us.es/net
2 parents bb52c7a + 1a31a4a commit c43c5f3

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

net/netfilter/nf_conntrack_netlink.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,12 +1358,15 @@ ctnetlink_create_conntrack(struct net *net, u16 zone,
13581358
nf_ct_protonum(ct));
13591359
if (helper == NULL) {
13601360
rcu_read_unlock();
1361+
spin_unlock_bh(&nf_conntrack_lock);
13611362
#ifdef CONFIG_MODULES
13621363
if (request_module("nfct-helper-%s", helpname) < 0) {
1364+
spin_lock_bh(&nf_conntrack_lock);
13631365
err = -EOPNOTSUPP;
13641366
goto err1;
13651367
}
13661368

1369+
spin_lock_bh(&nf_conntrack_lock);
13671370
rcu_read_lock();
13681371
helper = __nf_conntrack_helper_find(helpname,
13691372
nf_ct_l3num(ct),
@@ -1869,25 +1872,30 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
18691872

18701873
err = -ENOMEM;
18711874
skb2 = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
1872-
if (skb2 == NULL)
1875+
if (skb2 == NULL) {
1876+
nf_ct_expect_put(exp);
18731877
goto out;
1878+
}
18741879

18751880
rcu_read_lock();
18761881
err = ctnetlink_exp_fill_info(skb2, NETLINK_CB(skb).pid,
18771882
nlh->nlmsg_seq, IPCTNL_MSG_EXP_NEW, exp);
18781883
rcu_read_unlock();
1884+
nf_ct_expect_put(exp);
18791885
if (err <= 0)
18801886
goto free;
18811887

1882-
nf_ct_expect_put(exp);
1888+
err = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).pid, MSG_DONTWAIT);
1889+
if (err < 0)
1890+
goto out;
18831891

1884-
return netlink_unicast(ctnl, skb2, NETLINK_CB(skb).pid, MSG_DONTWAIT);
1892+
return 0;
18851893

18861894
free:
18871895
kfree_skb(skb2);
18881896
out:
1889-
nf_ct_expect_put(exp);
1890-
return err;
1897+
/* this avoids a loop in nfnetlink. */
1898+
return err == -EAGAIN ? -ENOBUFS : err;
18911899
}
18921900

18931901
static int

0 commit comments

Comments
 (0)