From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gao feng Subject: [PATCH v2 3/4] neigh: disallow un-init_net to change thresh of neigh Date: Fri, 14 Jun 2013 10:06:46 +0800 Message-ID: <1371175607-1405-3-git-send-email-gaofeng@cn.fujitsu.com> References: <1371175607-1405-1-git-send-email-gaofeng@cn.fujitsu.com> Cc: ebiederm@xmission.com, netdev@vger.kernel.org, Gao feng To: davem@davemloft.net Return-path: Received: from cn.fujitsu.com ([222.73.24.84]:52328 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1759124Ab3FNCFN (ORCPT ); Thu, 13 Jun 2013 22:05:13 -0400 In-Reply-To: <1371175607-1405-1-git-send-email-gaofeng@cn.fujitsu.com> Sender: netdev-owner@vger.kernel.org List-ID: thresh and interval are global resources, only init net can change them. 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 2ec1faf..5e0fe89 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -2049,6 +2049,12 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh) } } + err = -ENOENT; + 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]); -- 1.8.1.4