btrfs: zlib: zero-initialize zlib workspace
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@syzkaller.appspotmail.com CC: stable@vger.kernel.org # 5.4+ Signed-off-by: Alexander Potapenko <glider@google.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
a1406d5aa3
commit
f1fd16cd97
@@ -63,7 +63,7 @@ struct list_head *zlib_alloc_workspace(unsigned int level)
|
|||||||
|
|
||||||
workspacesize = max(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
|
workspacesize = max(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
|
||||||
zlib_inflate_workspacesize());
|
zlib_inflate_workspacesize());
|
||||||
workspace->strm.workspace = kvmalloc(workspacesize, GFP_KERNEL);
|
workspace->strm.workspace = kvzalloc(workspacesize, GFP_KERNEL);
|
||||||
workspace->level = level;
|
workspace->level = level;
|
||||||
workspace->buf = NULL;
|
workspace->buf = NULL;
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user