erofs: fix partially uninitialized misuse in z_erofs_onlinepage_fixup
authorGao Xiang <hsiangkao@redhat.com>
Thu, 18 Jun 2020 23:43:49 +0000 (07:43 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 30 Jun 2020 19:37:07 +0000 (15:37 -0400)
commit0236040fcf97d7d9e807d61e08f745678885271d
tree0ffa508588add01694b36924e9ff43a281d0edaa
parent824d0b6225f3fa2992704478a8df520537cfcb56
erofs: fix partially uninitialized misuse in z_erofs_onlinepage_fixup

commit 3c597282887fd55181578996dca52ce697d985a5 upstream.

Hongyu reported "id != index" in z_erofs_onlinepage_fixup() with
specific aarch64 environment easily, which wasn't shown before.

After digging into that, I found that high 32 bits of page->private
was set to 0xaaaaaaaa rather than 0 (due to z_erofs_onlinepage_init
behavior with specific compiler options). Actually we only use low
32 bits to keep the page information since page->private is only 4
bytes on most 32-bit platforms. However z_erofs_onlinepage_fixup()
uses the upper 32 bits by mistake.

Let's fix it now.

Reported-and-tested-by: Hongyu Jin <hongyu.jin@unisoc.com>
Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support")
Cc: <stable@vger.kernel.org> # 4.19+
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Link: https://lore.kernel.org/r/20200618234349.22553-1-hsiangkao@aol.com
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/erofs/zdata.h