Commit 262d8625 authored by Brenden Blanco's avatar Brenden Blanco Committed by David S. Miller

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: default avatarBrenden Blanco <bblanco@plumgrid.com>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cb7386d3
...@@ -2109,6 +2109,10 @@ static int do_setlink(const struct sk_buff *skb, ...@@ -2109,6 +2109,10 @@ static int do_setlink(const struct sk_buff *skb,
if (err < 0) if (err < 0)
goto errout; goto errout;
if (xdp[IFLA_XDP_ATTACHED]) {
err = -EINVAL;
goto errout;
}
if (xdp[IFLA_XDP_FD]) { if (xdp[IFLA_XDP_FD]) {
err = dev_change_xdp_fd(dev, err = dev_change_xdp_fd(dev,
nla_get_s32(xdp[IFLA_XDP_FD])); nla_get_s32(xdp[IFLA_XDP_FD]));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment