[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210615093555.GA26027@arm.com>
Date: Tue, 15 Jun 2021 10:35:56 +0100
From: Catalin Marinas <catalin.marinas@....com>
To: Yanfei Xu <yanfei.xu@...driver.com>
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/kmemleak: fix the possible wrong memory scanning
period
On Mon, Jun 14, 2021 at 01:40:22AM +0800, Yanfei Xu wrote:
> This commit contains 3 modifies:
>
> 1.Convert the type of jiffies_scan_wait to "unsigned long".
>
> 2.Use READ/WRITE_ONCE() for accessing "jiffies_scan_wait".
>
> 3.Fix the possible wrong memory scanning period. If you set a large
> memory scanning period like blow, then the "secs" variable will be
> non-zero, however the value of "jiffies_scan_wait" will be zero.
>
> echo "scan=0x10000000" > /sys/kernel/debug/kmemleak
>
> It is because the type of the msecs_to_jiffies()'s parameter is
> "unsigned int", and the "secs * 1000" is larger than its max value.
> This in turn leads a unexpected jiffies_scan_wait, maybe zero. We
> corret it by replacing kstrtoul() with kstrtouint(), and check the
> msecs to prevent it larger than UINT_MAX.
>
> Signed-off-by: Yanfei Xu <yanfei.xu@...driver.com>
Acked-by: Catalin Marinas <catalin.marinas@....com>
Powered by blists - more mailing lists