Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Nikolay Aleksandrov and committed by
David S. Miller
ce024f42 eefca20e

+3
+3
net/core/rtnetlink.c
··· 3854 3854 return -EMSGSIZE; 3855 3855 3856 3856 ifsm = nlmsg_data(nlh); 3857 + ifsm->family = PF_UNSPEC; 3858 + ifsm->pad1 = 0; 3859 + ifsm->pad2 = 0; 3857 3860 ifsm->ifindex = dev->ifindex; 3858 3861 ifsm->filter_mask = filter_mask; 3859 3862