linux_ioctl_hdio: fix kernel memory disclosure

Stack-allocated struct linux_hd_big_geometry has undeclared padding
copied to userland.

admbugs:	765
Reported by:	Vlad Tsyrklevich
MFC after:	1 day
Security:	Kernel memory disclosure
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste 2018-04-04 14:41:48 +00:00
parent cde6fa2857
commit d851b216eb

View File

@ -253,6 +253,7 @@ linux_ioctl_hdio(struct thread *td, struct linux_ioctl_args *args)
} else if ((args->cmd & 0xffff) == LINUX_HDIO_GET_GEO_BIG) { } else if ((args->cmd & 0xffff) == LINUX_HDIO_GET_GEO_BIG) {
struct linux_hd_big_geometry hdbg; struct linux_hd_big_geometry hdbg;
memset(&hdbg, 0, sizeof(hdbg));
hdbg.cylinders = fwcylinders; hdbg.cylinders = fwcylinders;
hdbg.heads = fwheads; hdbg.heads = fwheads;
hdbg.sectors = fwsectors; hdbg.sectors = fwsectors;