Commit 9be148e4 authored by Xiao Ni's avatar Xiao Ni Committed by Song Liu

async_xor: check src_offs is not NULL before updating it

When PAGE_SIZE is greater than 4kB, multiple stripes may share the same
page. Thus, src_offs is added to async_xor_offs() with array of offsets.
However, async_xor() passes NULL src_offs to async_xor_offs(). In such
case, src_offs should not be updated. Add a check before the update.

Fixes: ceaf2966(async_xor: increase src_offs when dropping destination page)
Cc: stable@vger.kernel.org # v5.10+
Reported-by: default avatarOleksandr Shchirskyi <oleksandr.shchirskyi@linux.intel.com>
Tested-by: default avatarOleksandr Shchirskyi <oleksandr.shchirskyi@intel.com>
Signed-off-by: default avatarXiao Ni <xni@redhat.com>
Signed-off-by: default avatarSong Liu <song@kernel.org>
parent 41fe8d08
...@@ -233,6 +233,7 @@ async_xor_offs(struct page *dest, unsigned int offset, ...@@ -233,6 +233,7 @@ async_xor_offs(struct page *dest, unsigned int offset,
if (submit->flags & ASYNC_TX_XOR_DROP_DST) { if (submit->flags & ASYNC_TX_XOR_DROP_DST) {
src_cnt--; src_cnt--;
src_list++; src_list++;
if (src_offs)
src_offs++; src_offs++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment