[Devel] Re: [BUG] net_cls: Panic occured when net_cls subsystem use

Jarek Poplawski jarkao2 at gmail.com
Mon Jun 1 14:55:42 PDT 2009


On Mon, Jun 01, 2009 at 10:49:57PM +0200, Jarek Poplawski wrote:
...
> Alas, I still think we don't need to change so much in -stable to
> fix the cls_cgroup oops, so I attach a patch which I think is
> enough for -stable and probably -net too. It could be "reverted"
> in -net-next just after applying cls_api patch. Of course, treat
> it only as my humble proposal, and feel free to recommend to David
> your version, no problem (really).

Since there are possible other oopses in cls_cgroup, here is an update
of patch #2.

Jarek P.
--------------------------> patch #2 (take 2)

 net/sched/cls_cgroup.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index 1ab4542..edb71e1 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -101,6 +101,8 @@ static int cls_cgroup_classify(struct sk_buff *skb, struct tcf_proto *tp,
 	struct cgroup_cls_state *cs;
 	int ret = 0;
 
+	if (!head)
+		return -1;
 	/*
 	 * Due to the nature of the classifier it is required to ignore all
 	 * packets originating from softirq context as accessing `current'
@@ -218,6 +220,9 @@ static void cls_cgroup_walk(struct tcf_proto *tp, struct tcf_walker *arg)
 {
 	struct cls_cgroup_head *head = tp->root;
 
+	if (!head)
+		return;
+
 	if (arg->count < arg->skip)
 		goto skip;
 
@@ -236,6 +241,9 @@ static int cls_cgroup_dump(struct tcf_proto *tp, unsigned long fh,
 	unsigned char *b = skb_tail_pointer(skb);
 	struct nlattr *nest;
 
+	if (!head)
+		return -1;
+
 	t->tcm_handle = head->handle;
 
 	nest = nla_nest_start(skb, TCA_OPTIONS);
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list