提交 262d8625 编写于 作者: B Brenden Blanco 提交者: 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: NBrenden Blanco <bblanco@plumgrid.com>
Acked-by: NAlexei Starovoitov <ast@kernel.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册