diff options
author | Nikolay Aleksandrov <nikolay@cumulusnetworks.com> | 2017-10-03 06:20:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-03 13:18:00 -0400 |
commit | ce024f42c2e28b6bce4ecc1e891b42f57f753892 (patch) | |
tree | a1409a700a40b3e4f0ab0dd5acf5df5808366897 /net | |
parent | eefca20eb20c66b06cf5ed09b49b1a7caaa27b7b (diff) |
net: rtnetlink: fix info leak in RTM_GETSTATS call
When RTM_GETSTATS was added the fields of its header struct were not all
initialized when returning the result thus leaking 4 bytes of information
to user-space per rtnl_fill_statsinfo call, so initialize them now. Thanks
to Alexander Potapenko for the detailed report and bisection.
Reported-by: Alexander Potapenko <glider@google.com>
Fixes: 10c9ead9f3c6 ("rtnetlink: add new RTM_GETSTATS message to dump link stats")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/rtnetlink.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index a78fd61da0ec..d4bcdcc68e92 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -3854,6 +3854,9 @@ static int rtnl_fill_statsinfo(struct sk_buff *skb, struct net_device *dev, | |||
3854 | return -EMSGSIZE; | 3854 | return -EMSGSIZE; |
3855 | 3855 | ||
3856 | ifsm = nlmsg_data(nlh); | 3856 | ifsm = nlmsg_data(nlh); |
3857 | ifsm->family = PF_UNSPEC; | ||
3858 | ifsm->pad1 = 0; | ||
3859 | ifsm->pad2 = 0; | ||
3857 | ifsm->ifindex = dev->ifindex; | 3860 | ifsm->ifindex = dev->ifindex; |
3858 | ifsm->filter_mask = filter_mask; | 3861 | ifsm->filter_mask = filter_mask; |
3859 | 3862 | ||