]> git.baikalelectronics.ru Git - kernel.git/commit
rtnetlink: fix if_nlmsg_stats_size() under estimation
authorEric Dumazet <edumazet@google.com>
Tue, 5 Oct 2021 21:04:17 +0000 (14:04 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Oct 2021 14:09:46 +0000 (15:09 +0100)
commit3589d3d09fc174728d0fc65b2396bb13eb7f08dd
tree76422a7776e5ba6948a3a293d5fe42feb8ebade1
parentedf13a9aa974d6d88e4700e012c23df5a984794e
rtnetlink: fix if_nlmsg_stats_size() under estimation

rtnl_fill_statsinfo() is filling skb with one mandatory if_stats_msg structure.

nlmsg_put(skb, pid, seq, type, sizeof(struct if_stats_msg), flags);

But if_nlmsg_stats_size() never considered the needed storage.

This bug did not show up because alloc_skb(X) allocates skb with
extra tailroom, because of added alignments. This could very well
be changed in the future to have deterministic behavior.

Fixes: 92d64bdc6015 ("rtnetlink: add new RTM_GETSTATS message to dump link stats")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Roopa Prabhu <roopa@nvidia.com>
Acked-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c