[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eebxwjzm5sdej3i5hb7pkj3w2xkacflxkeuetbyb7i4dpmltdl@lkysptw5owko>
Date: Tue, 18 Nov 2025 16:49:58 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Yuwen Chen <ywen.chen@...mail.com>
Cc: senozhatsky@...omium.org, akpm@...ux-foundation.org,
bgeffon@...gle.com, licayy@...look.com, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org, minchan@...nel.org, richardycc@...gle.com
Subject: Re: [PATCH] zram: Fix the issue that the write - back limits might
overflow
On (25/11/18 15:39), Yuwen Chen wrote:
> Since the value of bd_wb_limit is an unsigned number, when the
> page size is larger than 4 KB, it may cause an out-of-bounds situation.
>
> This patch fixes the issue by limiting bd_wb_limit to be an
> integer multiple of PAGE_SIZE / 4096.
>
> Fixes: 1d69a3f8ae77e ("zram: idle writeback fixes and cleanup")
> Signed-off-by: Yuwen Chen <ywen.chen@...mail.com>
> ---
> drivers/block/zram/zram_drv.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 4f2824a..4ecf2e7 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -562,6 +562,7 @@ static ssize_t writeback_limit_store(struct device *dev,
> if (kstrtoull(buf, 10, &val))
> return ret;
>
> + val = val & (~((1UL << (PAGE_SHIFT - 12)) - 1));
> down_read(&zram->init_lock);
> spin_lock(&zram->wb_limit_lock);
> zram->bd_wb_limit = val;
This patch is against unfixed writeback_limit_store() function,
it will need to be resubmitted once [1] lands.
[1] https://lore.kernel.org/linux-mm/20251118073000.1928107-1-senozhatsky@chromium.org
Powered by blists - more mailing lists