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

m68k: q40: Fix info-leak in rtc_ioctl

When the option is RTC_PLL_GET, pll will be copied to userland
via copy_to_user. pll is initialized using mach_get_rtc_pll indirect
call and mach_get_rtc_pll is only assigned with function
q40_get_rtc_pll in arch/m68k/q40/config.c.
In function q40_get_rtc_pll, the field pll_ctrl is not initialized.
This will leak uninitialized stack content to userland.
Fix this by zeroing the uninitialized field.

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Link: https://lore.kernel.org/r/20190927121544.7650-1-huangfq.daxian@gmail.com
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

authored by

Fuqian Huang and committed by
Geert Uytterhoeven
7cf78b6b 51b67a6e

+1
+1
arch/m68k/q40/config.c
··· 264 264 { 265 265 int tmp = Q40_RTC_CTRL; 266 266 267 + pll->pll_ctrl = 0; 267 268 pll->pll_value = tmp & Q40_RTC_PLL_MASK; 268 269 if (tmp & Q40_RTC_PLL_SIGN) 269 270 pll->pll_value = -pll->pll_value;