aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-12-30 13:04:14 -0500
committerDavid S. Miller <davem@davemloft.net>2011-12-30 13:04:14 -0500
commit7f8e3234c5f7fbdb06be050c8a1907e9c36d7c61 (patch)
treed6e9edb2087fa4a97b2cc3d585a0189672a14cf4 /net/netfilter
parent8ade06c616b34b4237c0ed77d1ff0ce04ad7d056 (diff)
parent89307babf966165171547f105e2253dec261cfa5 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nf_conntrack_netlink.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 85033344aed2..bb10c077a01a 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1367,12 +1367,15 @@ ctnetlink_create_conntrack(struct net *net, u16 zone,
1367 nf_ct_protonum(ct)); 1367 nf_ct_protonum(ct));
1368 if (helper == NULL) { 1368 if (helper == NULL) {
1369 rcu_read_unlock(); 1369 rcu_read_unlock();
1370 spin_unlock_bh(&nf_conntrack_lock);
1370#ifdef CONFIG_MODULES 1371#ifdef CONFIG_MODULES
1371 if (request_module("nfct-helper-%s", helpname) < 0) { 1372 if (request_module("nfct-helper-%s", helpname) < 0) {
1373 spin_lock_bh(&nf_conntrack_lock);
1372 err = -EOPNOTSUPP; 1374 err = -EOPNOTSUPP;
1373 goto err1; 1375 goto err1;
1374 } 1376 }
1375 1377
1378 spin_lock_bh(&nf_conntrack_lock);
1376 rcu_read_lock(); 1379 rcu_read_lock();
1377 helper = __nf_conntrack_helper_find(helpname, 1380 helper = __nf_conntrack_helper_find(helpname,
1378 nf_ct_l3num(ct), 1381 nf_ct_l3num(ct),
@@ -1880,25 +1883,30 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
1880 1883
1881 err = -ENOMEM; 1884 err = -ENOMEM;
1882 skb2 = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 1885 skb2 = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
1883 if (skb2 == NULL) 1886 if (skb2 == NULL) {
1887 nf_ct_expect_put(exp);
1884 goto out; 1888 goto out;
1889 }
1885 1890
1886 rcu_read_lock(); 1891 rcu_read_lock();
1887 err = ctnetlink_exp_fill_info(skb2, NETLINK_CB(skb).pid, 1892 err = ctnetlink_exp_fill_info(skb2, NETLINK_CB(skb).pid,
1888 nlh->nlmsg_seq, IPCTNL_MSG_EXP_NEW, exp); 1893 nlh->nlmsg_seq, IPCTNL_MSG_EXP_NEW, exp);
1889 rcu_read_unlock(); 1894 rcu_read_unlock();
1895 nf_ct_expect_put(exp);
1890 if (err <= 0) 1896 if (err <= 0)
1891 goto free; 1897 goto free;
1892 1898
1893 nf_ct_expect_put(exp); 1899 err = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).pid, MSG_DONTWAIT);
1900 if (err < 0)
1901 goto out;
1894 1902
1895 return netlink_unicast(ctnl, skb2, NETLINK_CB(skb).pid, MSG_DONTWAIT); 1903 return 0;
1896 1904
1897free: 1905free:
1898 kfree_skb(skb2); 1906 kfree_skb(skb2);
1899out: 1907out:
1900 nf_ct_expect_put(exp); 1908 /* this avoids a loop in nfnetlink. */
1901 return err; 1909 return err == -EAGAIN ? -ENOBUFS : err;
1902} 1910}
1903 1911
1904static int 1912static int