From patchwork Mon Jun 8 06:39:51 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minoru Usui X-Patchwork-Id: 28220 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 7D891B70A9 for ; Mon, 8 Jun 2009 17:00:18 +1000 (EST) Received: by ozlabs.org (Postfix) id 703A3DDDA0; Mon, 8 Jun 2009 17:00:18 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 16C1CDDD1C for ; Mon, 8 Jun 2009 17:00:18 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751639AbZFHHAH (ORCPT ); Mon, 8 Jun 2009 03:00:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751482AbZFHHAG (ORCPT ); Mon, 8 Jun 2009 03:00:06 -0400 Received: from TYO201.gate.nec.co.jp ([202.32.8.193]:50413 "EHLO tyo201.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750758AbZFHHAF (ORCPT ); Mon, 8 Jun 2009 03:00:05 -0400 Received: from mailgate3.nec.co.jp ([10.7.69.192]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id n586xhc8003101; Mon, 8 Jun 2009 15:59:43 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id n586xh226758; Mon, 8 Jun 2009 15:59:43 +0900 (JST) Received: from mail03.kamome.nec.co.jp (mail03.kamome.nec.co.jp [10.25.43.7]) by mailsv4.nec.co.jp (8.13.8/8.13.4) with ESMTP id n586xgdm027292; Mon, 8 Jun 2009 15:59:43 +0900 (JST) Received: from tatewaki.jp.nec.com ([10.26.220.19] [10.26.220.19]) by mail02.kamome.nec.co.jp with ESMTP id BT-MMP-850522; Mon, 8 Jun 2009 15:39:51 +0900 Received: from NES2061007292.nsl.ad.nec.co.jp ([10.21.43.215] [10.21.43.215]) by mail.jp.nec.com with ESMTP; Mon, 8 Jun 2009 15:39:51 +0900 Date: Mon, 8 Jun 2009 15:39:51 +0900 From: Minoru Usui To: tgraf@suug.ch Cc: containers@lists.linux-foundation.org, netdev@vger.kernel.org, hadi@cyberus.ca, jarkao2@gmail.com Subject: Re: [BUG] net_cls: Panic occured when net_cls subsystem use Message-Id: <20090608153951.dfa4b162.usui@mxm.nes.nec.co.jp> In-Reply-To: <20090601181201.ca1c2832.usui@mxm.nes.nec.co.jp> References: <20090521092256.d33717b9.usui@mxm.nes.nec.co.jp> <20090601181201.ca1c2832.usui@mxm.nes.nec.co.jp> X-Mailer: Sylpheed 2.6.0 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Thomas On Mon, 1 Jun 2009 18:12:01 +0900 Minoru Usui wrote: > Hi Thomas > > Original mail sent to netdev and containers before. > (http://www.spinics.net/lists/netdev/msg97745.html) > > I have a question about how to use cls_cgroup. > > On Thu, 21 May 2009 09:22:56 +0900 > Minoru Usui wrote: > > > Hi > > > > Unfortunately this is only panic report. > > > > I used cgroup net_cls subsystem, then kernel panic occured. > > I attach panic message and kernel config in this mail's last paragraph. > > If my operation is wrong, could you tell me how to use net_cls and > > where the documentation is. > > > > # But I think panic is very bad even if my operation is wrong. > > The cause of panic will fix soon. (Now I'll make a patch and will test it.) > > I want to know how to use cls_cgroup correctly, so could you tell me how to use it if my operation is wrong. > Now, I think I might have to specify 'handle' with tc command line, is this true? > But when I specified 'handle', I faced oops. X-P I investigated this problem, and I found a bug in cls_cgroup_change() in cls_cgroup.c. cls_cgroup_change() expected tca[TCA_OPTIONS] was set from user space properly, but tc in iproute2-2.6.29-1 (which I used) didn't set it. I saw the current source code of tc in git, I found the code for cls_cgroup in iproute2/tc/f_cgroup.c. It set tca[TCA_OPTIONS]. git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git # Unfortunately, current source coude of iproute2 couldn't compile, because it occured compile error. X-P # But this is another issue. If we always use a newest iproute2 in git when we use cls_cgroup, we don't face this oops probably. But I think, kernel shouldn't panic regardless of use program's behaviour. Signed-off-by: Minoru Usui diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index cc29b44..2ec0adc 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c @@ -167,6 +167,9 @@ static int cls_cgroup_change(struct tcf_proto *tp, unsigned long base, struct tcf_exts e; int err; + if (!tca[TCA_OPTIONS]) + return -EINVAL; + if (head == NULL) { if (!handle) return -EINVAL;