Skip to content

Commit

Permalink
m68k: q40: Fix info-leak in rtc_ioctl
Browse files Browse the repository at this point in the history
[ Upstream commit 7cf78b6 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yellow-Pay authored and gregkh committed Oct 1, 2020
1 parent bbe4f5e commit ff099d7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions arch/m68k/q40/config.c
Expand Up @@ -264,6 +264,7 @@ static int q40_get_rtc_pll(struct rtc_pll_info *pll)
{
int tmp = Q40_RTC_CTRL;

pll->pll_ctrl = 0;
pll->pll_value = tmp & Q40_RTC_PLL_MASK;
if (tmp & Q40_RTC_PLL_SIGN)
pll->pll_value = -pll->pll_value;
Expand Down

0 comments on commit ff099d7

Please sign in to comment.