Skip to content

Commit

Permalink
rtnetlink: fix rtnl message size computation for XDP
Browse files Browse the repository at this point in the history
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: d1fdd91 ("rtnl: add option for setting link xdp prog")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Brenden Blanco <bblanco@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sabrina Dubroca authored and David S. Miller committed Nov 16, 2016
1 parent 7e75f74 commit b3cfaa3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b3cfaa3

Please sign in to comment.