]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
x86/mtrr: Don't copy uninitialized gentry fields back to userspace
authorColin Ian King <colin.king@canonical.com>
Tue, 18 Dec 2018 17:29:56 +0000 (17:29 +0000)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit0b0d95a0d186f52e9da7a5979e9ad5f1d6733f7e
treea848f8b146bc397e9e829b8697101112585e289b
parent582bcbd2f0283a783f2efd1b32fe751b2e5dc70d
x86/mtrr: Don't copy uninitialized gentry fields back to userspace

BugLink: https://bugs.launchpad.net/bugs/1837257
commit 32043fa065b51e0b1433e48d118821c71b5cd65d upstream.

Currently the copy_to_user of data in the gentry struct is copying
uninitiaized data in field _pad from the stack to userspace.

Fix this by explicitly memset'ing gentry to zero, this also will zero any
compiler added padding fields that may be in struct (currently there are
none).

Detected by CoverityScan, CID#200783 ("Uninitialized scalar variable")

Fixes: b263b31e8ad6 ("x86, mtrr: Use explicit sizing and padding for the 64-bit ioctls")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
Cc: security@kernel.org
Link: https://lkml.kernel.org/r/20181218172956.1440-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
arch/x86/kernel/cpu/mtrr/if.c