diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-05-23 22:37:01 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:33 -0400 |
commit | c346def9af1d3890ee604905fb08d689e8383855 (patch) | |
tree | 90a16410ccc67e14ada6e6822df4f0c9c22b20eb /fs/bcachefs/checksum.c | |
parent | 232697ab9ded81d56afa8a2e47edb48deea5f9e6 (diff) | |
download | linux-c346def9af1d3890ee604905fb08d689e8383855.tar.gz linux-c346def9af1d3890ee604905fb08d689e8383855.tar.bz2 linux-c346def9af1d3890ee604905fb08d689e8383855.zip |
bcachefs: Fix encryption path on arm
flush_dcache_page() is not a noop on arm, but we were using
virt_to_page() instead of vmalloc_to_page() for an address on the kernel
stack - vmalloc memory, leading to an oops in flush_dcache_page().
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/checksum.c')
-rw-r--r-- | fs/bcachefs/checksum.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/bcachefs/checksum.c b/fs/bcachefs/checksum.c index 50157b4013a5..317efd047a46 100644 --- a/fs/bcachefs/checksum.c +++ b/fs/bcachefs/checksum.c @@ -116,7 +116,12 @@ static inline int do_encrypt(struct crypto_sync_skcipher *tfm, { struct scatterlist sg; - sg_init_one(&sg, buf, len); + sg_init_table(&sg, 1); + sg_set_page(&sg, + is_vmalloc_addr(buf) + ? vmalloc_to_page(buf) + : virt_to_page(buf), + len, offset_in_page(buf)); return do_encrypt_sg(tfm, nonce, &sg, len); } |