aboutsummaryrefslogtreecommitdiffstats
path: root/net
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
parent8ade06c616b34b4237c0ed77d1ff0ce04ad7d056 (diff)
parent89307babf966165171547f105e2253dec261cfa5 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nf_conntrack_netlink.c18
-rw-r--r--net/packet/af_packet.c6
-rw-r--r--net/sched/sch_netem.c7
3 files changed, 22 insertions, 9 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
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index e56ca75e3f43..2dbb32b988c4 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2453,8 +2453,12 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc
2453{ 2453{
2454 struct packet_sock *po = pkt_sk(sk); 2454 struct packet_sock *po = pkt_sk(sk);
2455 2455
2456 if (po->fanout) 2456 if (po->fanout) {
2457 if (dev)
2458 dev_put(dev);
2459
2457 return -EINVAL; 2460 return -EINVAL;
2461 }
2458 2462
2459 lock_sock(sk); 2463 lock_sock(sk);
2460 2464
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index ffcaa5975947..a92c1b3dab83 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -532,7 +532,7 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr)
532 return -EINVAL; 532 return -EINVAL;
533 533
534 s = sizeof(struct disttable) + n * sizeof(s16); 534 s = sizeof(struct disttable) + n * sizeof(s16);
535 d = kmalloc(s, GFP_KERNEL); 535 d = kmalloc(s, GFP_KERNEL | __GFP_NOWARN);
536 if (!d) 536 if (!d)
537 d = vmalloc(s); 537 d = vmalloc(s);
538 if (!d) 538 if (!d)
@@ -545,9 +545,10 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr)
545 root_lock = qdisc_root_sleeping_lock(sch); 545 root_lock = qdisc_root_sleeping_lock(sch);
546 546
547 spin_lock_bh(root_lock); 547 spin_lock_bh(root_lock);
548 dist_free(q->delay_dist); 548 swap(q->delay_dist, d);
549 q->delay_dist = d;
550 spin_unlock_bh(root_lock); 549 spin_unlock_bh(root_lock);
550
551 dist_free(d);
551 return 0; 552 return 0;
552} 553}
553 554