summaryrefslogtreecommitdiffstats
path: root/net/core/neighbour.c
diff options
context:
space:
mode:
authorGao feng2013-06-20 04:01:34 +0200
committerDavid S. Miller2013-06-20 06:13:24 +0200
commitdc25c676f54addb10e598daa9da9b8dd4fd487ab (patch)
treeec051c49410942a463d23fc9583a649851c8bff5 /net/core/neighbour.c
parentneigh: only allow init_net to change the default neigh_parms (diff)
downloadkernel-qcow2-linux-dc25c676f54addb10e598daa9da9b8dd4fd487ab.tar.gz
kernel-qcow2-linux-dc25c676f54addb10e598daa9da9b8dd4fd487ab.tar.xz
kernel-qcow2-linux-dc25c676f54addb10e598daa9da9b8dd4fd487ab.zip
neigh: disallow un-init_net to change thresh of neigh
thresh and interval are global resources, only init net can change them. Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/neighbour.c')
-rw-r--r--net/core/neighbour.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 86f9b165bbba..2569ab2cafbe 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]);