linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] m68k: q40: Fix info-leak in rtc_ioctl
@ 2019-09-27 12:15 Fuqian Huang
  2019-09-27 12:43 ` Geert Uytterhoeven
  0 siblings, 1 reply; 2+ messages in thread
From: Fuqian Huang @ 2019-09-27 12:15 UTC (permalink / raw)
  Cc: Geert Uytterhoeven, linux-m68k, linux-kernel, Fuqian Huang

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>
---
 arch/m68k/q40/config.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index e63eb5f06999..f31890078197 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -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;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] m68k: q40: Fix info-leak in rtc_ioctl
  2019-09-27 12:15 [PATCH] m68k: q40: Fix info-leak in rtc_ioctl Fuqian Huang
@ 2019-09-27 12:43 ` Geert Uytterhoeven
  0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2019-09-27 12:43 UTC (permalink / raw)
  To: Fuqian Huang; +Cc: linux-m68k, Linux Kernel Mailing List

Hi Fuqian,

On Fri, Sep 27, 2019 at 2:15 PM Fuqian Huang <huangfq.daxian@gmail.com> wrote:
> 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>

Thanks for your patch!

> --- a/arch/m68k/q40/config.c
> +++ b/arch/m68k/q40/config.c
> @@ -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;

Nice catch!

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue for v5.5.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-27 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-27 12:15 [PATCH] m68k: q40: Fix info-leak in rtc_ioctl Fuqian Huang
2019-09-27 12:43 ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).