aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-07-06 00:08:43 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-06 00:08:43 -0400
commit075d6adf909ac8706bd0be7832e6dadb0aef314b (patch)
treef9036aeb464a2492ce69b2fbb24d36f26c1310d3 /net
parente2a305ecb5734f24d3a4496605a6fdf27ddf7108 (diff)
parent4fe683f50d3fc8e36d4749277631dfc711393aa0 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: [PKT_SCHED]: Fix error handling while dumping actions [PKT_SCHED]: Return ENOENT if action module is unavailable [PKT_SCHED]: Fix illegal memory dereferences when dumping actions
Diffstat (limited to 'net')
-rw-r--r--net/sched/act_api.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 5b9397b33238..599423cc9d0d 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -250,15 +250,17 @@ tcf_action_dump(struct sk_buff *skb, struct tc_action *act, int bind, int ref)
250 RTA_PUT(skb, a->order, 0, NULL); 250 RTA_PUT(skb, a->order, 0, NULL);
251 err = tcf_action_dump_1(skb, a, bind, ref); 251 err = tcf_action_dump_1(skb, a, bind, ref);
252 if (err < 0) 252 if (err < 0)
253 goto rtattr_failure; 253 goto errout;
254 r->rta_len = skb->tail - (u8*)r; 254 r->rta_len = skb->tail - (u8*)r;
255 } 255 }
256 256
257 return 0; 257 return 0;
258 258
259rtattr_failure: 259rtattr_failure:
260 err = -EINVAL;
261errout:
260 skb_trim(skb, b - skb->data); 262 skb_trim(skb, b - skb->data);
261 return -err; 263 return err;
262} 264}
263 265
264struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est, 266struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est,
@@ -305,6 +307,7 @@ struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est,
305 goto err_mod; 307 goto err_mod;
306 } 308 }
307#endif 309#endif
310 *err = -ENOENT;
308 goto err_out; 311 goto err_out;
309 } 312 }
310 313
@@ -776,7 +779,7 @@ replay:
776 return ret; 779 return ret;
777} 780}
778 781
779static char * 782static struct rtattr *
780find_dump_kind(struct nlmsghdr *n) 783find_dump_kind(struct nlmsghdr *n)
781{ 784{
782 struct rtattr *tb1, *tb2[TCA_ACT_MAX+1]; 785 struct rtattr *tb1, *tb2[TCA_ACT_MAX+1];
@@ -804,7 +807,7 @@ find_dump_kind(struct nlmsghdr *n)
804 return NULL; 807 return NULL;
805 kind = tb2[TCA_ACT_KIND-1]; 808 kind = tb2[TCA_ACT_KIND-1];
806 809
807 return (char *) RTA_DATA(kind); 810 return kind;
808} 811}
809 812
810static int 813static int
@@ -817,16 +820,15 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
817 struct tc_action a; 820 struct tc_action a;
818 int ret = 0; 821 int ret = 0;
819 struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh); 822 struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh);
820 char *kind = find_dump_kind(cb->nlh); 823 struct rtattr *kind = find_dump_kind(cb->nlh);
821 824
822 if (kind == NULL) { 825 if (kind == NULL) {
823 printk("tc_dump_action: action bad kind\n"); 826 printk("tc_dump_action: action bad kind\n");
824 return 0; 827 return 0;
825 } 828 }
826 829
827 a_o = tc_lookup_action_n(kind); 830 a_o = tc_lookup_action(kind);
828 if (a_o == NULL) { 831 if (a_o == NULL) {
829 printk("failed to find %s\n", kind);
830 return 0; 832 return 0;
831 } 833 }
832 834
@@ -834,7 +836,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
834 a.ops = a_o; 836 a.ops = a_o;
835 837
836 if (a_o->walk == NULL) { 838 if (a_o->walk == NULL) {
837 printk("tc_dump_action: %s !capable of dumping table\n", kind); 839 printk("tc_dump_action: %s !capable of dumping table\n", a_o->kind);
838 goto rtattr_failure; 840 goto rtattr_failure;
839 } 841 }
840 842