Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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]));