From patchwork Wed Jun 12 04:34:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gao feng X-Patchwork-Id: 250667 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 6EDA92C0095 for ; Wed, 12 Jun 2013 14:34:07 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752266Ab3FLEeA (ORCPT ); Wed, 12 Jun 2013 00:34:00 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:9781 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751266Ab3FLEd6 (ORCPT ); Wed, 12 Jun 2013 00:33:58 -0400 X-IronPort-AV: E=Sophos;i="4.87,848,1363104000"; d="scan'208";a="7524055" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 12 Jun 2013 12:31:02 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r5C4Xt0p017777; Wed, 12 Jun 2013 12:33:55 +0800 Received: from Donkey.fnst.cn.fujitsu.com ([10.167.233.32]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013061212320286-2052573 ; Wed, 12 Jun 2013 12:32:02 +0800 From: Gao feng To: davem@davemloft.net Cc: ebiederm@xmission.com, netdev@vger.kernel.org, Gao feng , Gao feng Subject: [PATCH 2/2] neigh: disallow un-init_net to change thresh of neigh Date: Wed, 12 Jun 2013 12:34:11 +0800 Message-Id: <1371011651-30894-2-git-send-email-gaofeng@cn.fujitsu.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1371011651-30894-1-git-send-email-gaofeng@cn.fujitsu.com> References: <1371011651-30894-1-git-send-email-gaofeng@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/06/12 12:32:03, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/06/12 12:32:03, Serialize complete at 2013/06/12 12:32:03 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Gao feng thresh is a global resource, only init net can change it. Signed-off-by: Gao feng --- net/core/neighbour.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/core/neighbour.c b/net/core/neighbour.c index e4027ff..8feb382 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -2056,6 +2056,12 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh) } } + err = -EPERM; + if ((tb[NDTA_THRESH1] || tb[NDTA_THRESH2] || + tb[NDTA_THRESH3] || tb[NDTA_GC_INTERVAL]) && + !net_eq(net, &init_net)) + goto errout_tbl_lock; + if (tb[NDTA_THRESH1]) tbl->gc_thresh1 = nla_get_u32(tb[NDTA_THRESH1]);