* [PATCH] zram: fix potential UAF of zram table
@ 2025-01-07 6:54 Kairui Song
2025-01-07 7:38 ` Sergey Senozhatsky
0 siblings, 1 reply; 2+ messages in thread
From: Kairui Song @ 2025-01-07 6:54 UTC (permalink / raw)
To: linux-mm
Cc: Minchan Kim, Sergey Senozhatsky, Andrew Morton, linux-block,
linux-kernel, Kairui Song, stable
From: Kairui Song <kasong@tencent.com>
If zram_meta_alloc failed early, it frees allocated zram->table without
setting it NULL. Which will potentially cause zram_meta_free to access
the table if user reset an failed and uninitialized device.
Fixes: 74363ec674cb ("zram: fix uninitialized ZRAM not releasing backing device")
Cc: <stable@vger.kernel.org>
Signed-off-by: Kairui Song <kasong@tencent.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 5b8e4f4171ab..70ecaee25c20 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1465,6 +1465,7 @@ static bool zram_meta_alloc(struct zram *zram, u64 disksize)
zram->mem_pool = zs_create_pool(zram->disk->disk_name);
if (!zram->mem_pool) {
vfree(zram->table);
+ zram->table = NULL;
return false;
}
--
2.47.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] zram: fix potential UAF of zram table
2025-01-07 6:54 [PATCH] zram: fix potential UAF of zram table Kairui Song
@ 2025-01-07 7:38 ` Sergey Senozhatsky
0 siblings, 0 replies; 2+ messages in thread
From: Sergey Senozhatsky @ 2025-01-07 7:38 UTC (permalink / raw)
To: Andrew Morton, Kairui Song
Cc: linux-mm, Minchan Kim, Sergey Senozhatsky, linux-block,
linux-kernel, stable
On (25/01/07 14:54), Kairui Song wrote:
> From: Kairui Song <kasong@tencent.com>
>
> If zram_meta_alloc failed early, it frees allocated zram->table without
> setting it NULL. Which will potentially cause zram_meta_free to access
> the table if user reset an failed and uninitialized device.
>
> Fixes: 74363ec674cb ("zram: fix uninitialized ZRAM not releasing backing device")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Kairui Song <kasong@tencent.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-01-07 7:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-07 6:54 [PATCH] zram: fix potential UAF of zram table Kairui Song
2025-01-07 7:38 ` Sergey Senozhatsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox