From: Robert Shearman Date: Wed, 22 Apr 2015 10:14:39 +0000 (+0100) Subject: mpls: Prevent use of implicit NULL label as outgoing label X-Git-Tag: submit/tizen/20160607.132125~2530^2~31^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a9ab0176198d91dfc153f5e6c5fdc5afa613607;p=sdk%2Femulator%2Femulator-kernel.git mpls: Prevent use of implicit NULL label as outgoing label The reserved implicit-NULL label isn't allowed to appear in the label stack for packets, so make it an error for the control plane to specify it as an outgoing label. Suggested-by: "Eric W. Biederman" Signed-off-by: Robert Shearman Reviewed-by: "Eric W. Biederman" Signed-off-by: David S. Miller --- diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index 9fdd94c..954810c 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c @@ -646,6 +646,15 @@ int nla_get_labels(const struct nlattr *nla, if ((dec.bos != bos) || dec.ttl || dec.tc) return -EINVAL; + switch (dec.label) { + case LABEL_IMPLICIT_NULL: + /* RFC3032: This is a label that an LSR may + * assign and distribute, but which never + * actually appears in the encapsulation. + */ + return -EINVAL; + } + label[i] = dec.label; } *labels = nla_labels;