From: Brenden Blanco Date: Thu, 21 Jul 2016 00:22:34 +0000 (-0700) Subject: rtnl: protect do_setlink from IFLA_XDP_ATTACHED X-Git-Tag: v4.8-rc1~140^2~50^2~1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=262d8625045e0c81b7859ecd192e9811710f19da;p=karo-tx-linux.git rtnl: protect do_setlink from IFLA_XDP_ATTACHED The IFLA_XDP_ATTACHED nested attribute is meant for read-only, and while do_setlink properly ignores it, it should be more paranoid and reject commands that try to set it. Signed-off-by: Brenden Blanco Acked-by: Alexei Starovoitov Signed-off-by: David S. Miller --- diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index eba2b8260dbd..189cc78c77eb 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -2109,6 +2109,10 @@ static int do_setlink(const struct sk_buff *skb, if (err < 0) goto errout; + if (xdp[IFLA_XDP_ATTACHED]) { + err = -EINVAL; + goto errout; + } if (xdp[IFLA_XDP_FD]) { err = dev_change_xdp_fd(dev, nla_get_s32(xdp[IFLA_XDP_FD]));