[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190627173649.GA18346@agluck-desk2.amr.corp.intel.com>
Date: Thu, 27 Jun 2019 10:36:49 -0700
From: "Luck, Tony" <tony.luck@...el.com>
To: James Morse <james.morse@....com>
Cc: Eiichi Tsukata <devel@...ukata.com>, bp@...en8.de,
mchehab@...nel.org, linux-edac@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] EDAC: Fix global-out-of-bounds write when setting
edac_mc_poll_msec
On Thu, Jun 27, 2019 at 06:11:18PM +0100, James Morse wrote:
> Hello,
>
> (CC: +Tony Luck.
> Original Patch: lore.kernel.org/r/20190626054011.30044-1-devel@...ukata.com )
Heh: My mail agent "helpfully" made that clickable, but as a "mailto:"
URL rather than an https: one!
>
> On 26/06/2019 06:40, Eiichi Tsukata wrote:
> > Commit 9da21b1509d8 ("EDAC: Poll timeout cannot be zero, p2") assumes
> > edac_mc_poll_msec to be unsigned long, but the type of the variable still
> > remained as int. Setting edac_mc_poll_msec can trigger out-of-bounds
> > write.
>
> Thanks for catching this!
Ditto & likewise.
>
>
> > Fix it by changing the type of edac_mc_poll_msec to unsigned int.
>
> This means reverting more of 9da21b1509d8, but it also fixes signed/unsigned issues:
> | root@...ian-guest:/sys/module/edac_core/parameters# echo 4294967295 > edac_mc_poll_msec
> | root@...ian-guest:/sys/module/edac_core/parameters# cat edac_mc_poll_msec
> | -1
> | root@...ian-guest:/sys/module/edac_core/parameters# echo -1 > edac_mc_poll_msec
> | -bash: echo: write error: Invalid argument
>
>
> > The reason why this patch adopts unsigned int rather than unsigned long
> > is msecs_to_jiffies() assumes arg to be unsigned int.
>
> Ah, so the range is limited anyway.
>
> It looks like it was switched to long to be consistent with edac_mc_workq_setup(), which
> has since been removed in preference to msecs_to_jiffies().
>
>
> Reviewed-by: James Morse <james.morse@....com>
Applied. (Boris left me in charge of EDAC bits for the
next few weeks). It will show up in the for_5.3 branch
of:
git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git
after test builds complete.
-Tony
Powered by blists - more mailing lists