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

Commit b3cfaa31 authored by Sabrina Dubroca's avatar Sabrina Dubroca Committed by David S. Miller
Browse files

rtnetlink: fix rtnl message size computation for XDP



rtnl_xdp_size() only considers the size of the actual payload attribute,
and misses the space taken by the attribute used for nesting (IFLA_XDP).

Fixes: d1fdd913 ("rtnl: add option for setting link xdp prog")
Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
Reviewed-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7e75f74a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -901,7 +901,8 @@ static size_t rtnl_port_size(const struct net_device *dev,

static size_t rtnl_xdp_size(const struct net_device *dev)
{
	size_t xdp_size = nla_total_size(1);	/* XDP_ATTACHED */
	size_t xdp_size = nla_total_size(0) +	/* nest IFLA_XDP */
			  nla_total_size(1);	/* XDP_ATTACHED */

	if (!dev->netdev_ops->ndo_xdp)
		return 0;