]> git.baikalelectronics.ru Git - kernel.git/commit
rtnetlink: Fix message size calculation for link messages
authorThomas Graf <tgraf@infradead.org>
Thu, 11 Nov 2010 15:47:59 +0000 (15:47 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 Nov 2010 18:53:09 +0000 (10:53 -0800)
commit3676fe5c794fc5c32d89c48410ff7577d958ae99
tree6bd88b669c8c68ac4d9008e00566ca15e43a6ff4
parent7a5bd0beba5c8124c140aae3b78115a351c0b65c
rtnetlink: Fix message size calculation for link messages

nlmsg_total_size() calculates the length of a netlink message
including header and alignment. nla_total_size() calculates the
space an individual attribute consumes which was meant to be used
in this context.

Also, ensure to account for the attribute header for the
IFLA_INFO_XSTATS attribute as implementations of get_xstats_size()
seem to assume that we do so.

The addition of two message headers minus the missing attribute
header resulted in a calculated message size that was larger than
required. Therefore we never risked running out of skb tailroom.

Signed-off-by: Thomas Graf <tgraf@infradead.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c