[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20230215070620.2718851-3-sashal@kernel.org>
Date: Wed, 15 Feb 2023 02:04:50 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Alexander Potapenko <glider@...gle.com>,
syzbot+14d9e7602ebdf7ec0a60@...kaller.appspotmail.com,
David Sterba <dsterba@...e.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, clm@...com,
josef@...icpanda.com, linux-btrfs@...r.kernel.org
Subject: [PATCH AUTOSEL 6.1 03/93] btrfs: zlib: zero-initialize zlib workspace
From: Alexander Potapenko <glider@...gle.com>
commit eadd7deca0ad8a83edb2b894d8326c78e78635d6 upstream.
KMSAN reports uses of uninitialized memory in zlib's longest_match()
called on memory originating from zlib_alloc_workspace().
This issue is known by zlib maintainers and is claimed to be harmless,
but to be on the safe side we'd better initialize the memory.
Link: https://zlib.net/zlib_faq.html#faq36
Reported-by: syzbot+14d9e7602ebdf7ec0a60@...kaller.appspotmail.com
CC: stable@...r.kernel.org # 5.4+
Signed-off-by: Alexander Potapenko <glider@...gle.com>
Reviewed-by: David Sterba <dsterba@...e.com>
Signed-off-by: David Sterba <dsterba@...e.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/btrfs/zlib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c
index b4f44662cda7c..94d06a76edb17 100644
--- a/fs/btrfs/zlib.c
+++ b/fs/btrfs/zlib.c
@@ -63,7 +63,7 @@ struct list_head *zlib_alloc_workspace(unsigned int level)
workspacesize = max(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
zlib_inflate_workspacesize());
- workspace->strm.workspace = kvmalloc(workspacesize, GFP_KERNEL);
+ workspace->strm.workspace = kvzalloc(workspacesize, GFP_KERNEL);
workspace->level = level;
workspace->buf = NULL;
/*
--
2.39.0
Powered by blists - more mailing lists