Skip to content

Commit

Permalink
rtnl: protect do_setlink from IFLA_XDP_ATTACHED
Browse files Browse the repository at this point in the history
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 <bblanco@plumgrid.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Brenden Blanco authored and David S. Miller committed Jul 21, 2016
1 parent cb7386d commit 262d862
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
Expand Down

0 comments on commit 262d862

Please sign in to comment.