aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/sch_api.c')
-rw-r--r--net/sched/sch_api.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 259321be1ad8..f30e3f7ad885 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -29,6 +29,7 @@
29#include <linux/hrtimer.h> 29#include <linux/hrtimer.h>
30 30
31#include <net/net_namespace.h> 31#include <net/net_namespace.h>
32#include <net/sock.h>
32#include <net/netlink.h> 33#include <net/netlink.h>
33#include <net/pkt_sched.h> 34#include <net/pkt_sched.h>
34 35
@@ -599,6 +600,7 @@ check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w)
599 600
600static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) 601static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
601{ 602{
603 struct net *net = skb->sk->sk_net;
602 struct tcmsg *tcm = NLMSG_DATA(n); 604 struct tcmsg *tcm = NLMSG_DATA(n);
603 struct rtattr **tca = arg; 605 struct rtattr **tca = arg;
604 struct net_device *dev; 606 struct net_device *dev;
@@ -607,6 +609,9 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
607 struct Qdisc *p = NULL; 609 struct Qdisc *p = NULL;
608 int err; 610 int err;
609 611
612 if (net != &init_net)
613 return -EINVAL;
614
610 if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) 615 if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)
611 return -ENODEV; 616 return -ENODEV;
612 617
@@ -660,6 +665,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
660 665
661static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) 666static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
662{ 667{
668 struct net *net = skb->sk->sk_net;
663 struct tcmsg *tcm; 669 struct tcmsg *tcm;
664 struct rtattr **tca; 670 struct rtattr **tca;
665 struct net_device *dev; 671 struct net_device *dev;
@@ -667,6 +673,9 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
667 struct Qdisc *q, *p; 673 struct Qdisc *q, *p;
668 int err; 674 int err;
669 675
676 if (net != &init_net)
677 return -EINVAL;
678
670replay: 679replay:
671 /* Reinit, just in case something touches this. */ 680 /* Reinit, just in case something touches this. */
672 tcm = NLMSG_DATA(n); 681 tcm = NLMSG_DATA(n);
@@ -872,11 +881,15 @@ err_out:
872 881
873static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) 882static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
874{ 883{
884 struct net *net = skb->sk->sk_net;
875 int idx, q_idx; 885 int idx, q_idx;
876 int s_idx, s_q_idx; 886 int s_idx, s_q_idx;
877 struct net_device *dev; 887 struct net_device *dev;
878 struct Qdisc *q; 888 struct Qdisc *q;
879 889
890 if (net != &init_net)
891 return 0;
892
880 s_idx = cb->args[0]; 893 s_idx = cb->args[0];
881 s_q_idx = q_idx = cb->args[1]; 894 s_q_idx = q_idx = cb->args[1];
882 read_lock(&dev_base_lock); 895 read_lock(&dev_base_lock);
@@ -920,6 +933,7 @@ done:
920 933
921static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg) 934static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
922{ 935{
936 struct net *net = skb->sk->sk_net;
923 struct tcmsg *tcm = NLMSG_DATA(n); 937 struct tcmsg *tcm = NLMSG_DATA(n);
924 struct rtattr **tca = arg; 938 struct rtattr **tca = arg;
925 struct net_device *dev; 939 struct net_device *dev;
@@ -932,6 +946,9 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
932 u32 qid = TC_H_MAJ(clid); 946 u32 qid = TC_H_MAJ(clid);
933 int err; 947 int err;
934 948
949 if (net != &init_net)
950 return -EINVAL;
951
935 if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) 952 if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)
936 return -ENODEV; 953 return -ENODEV;
937 954
@@ -1106,6 +1123,7 @@ static int qdisc_class_dump(struct Qdisc *q, unsigned long cl, struct qdisc_walk
1106 1123
1107static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) 1124static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
1108{ 1125{
1126 struct net *net = skb->sk->sk_net;
1109 int t; 1127 int t;
1110 int s_t; 1128 int s_t;
1111 struct net_device *dev; 1129 struct net_device *dev;
@@ -1113,6 +1131,9 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
1113 struct tcmsg *tcm = (struct tcmsg*)NLMSG_DATA(cb->nlh); 1131 struct tcmsg *tcm = (struct tcmsg*)NLMSG_DATA(cb->nlh);
1114 struct qdisc_dump_args arg; 1132 struct qdisc_dump_args arg;
1115 1133
1134 if (net != &init_net)
1135 return 0;
1136
1116 if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) 1137 if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))
1117 return 0; 1138 return 0;
1118 if ((dev = dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) 1139 if ((dev = dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)