Skip to content

Commit 3a60f65

Browse files
committed
Revert "btrfs: compression: drop kmap/kunmap from generic helpers"
This reverts commit 4c2bf27. The kmaps in compression code are still needed and cause crashes on 32bit machines (ARM, x86). Reproducible eg. by running fstest btrfs/004 with enabled LZO or ZSTD compression. Link: https://lore.kernel.org/all/CAJCQCtT+OuemovPO7GZk8Y8=qtOObr0XTDp8jh4OHD6y84AFxw@mail.gmail.com/ Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=214839 Signed-off-by: David Sterba <[email protected]>
1 parent 4afb912 commit 3a60f65

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

fs/btrfs/compression.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,10 @@ static int check_compressed_csum(struct btrfs_inode *inode, struct bio *bio,
172172
/* Hash through the page sector by sector */
173173
for (pg_offset = 0; pg_offset < bytes_left;
174174
pg_offset += sectorsize) {
175-
kaddr = page_address(page);
175+
kaddr = kmap_atomic(page);
176176
crypto_shash_digest(shash, kaddr + pg_offset,
177177
sectorsize, csum);
178+
kunmap_atomic(kaddr);
178179

179180
if (memcmp(&csum, cb_sum, csum_size) != 0) {
180181
btrfs_print_data_csum_error(inode, disk_start,

fs/btrfs/inode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,9 @@ static int insert_inline_extent(struct btrfs_trans_handle *trans,
287287
cur_size = min_t(unsigned long, compressed_size,
288288
PAGE_SIZE);
289289

290-
kaddr = page_address(cpage);
290+
kaddr = kmap_atomic(cpage);
291291
write_extent_buffer(leaf, kaddr, ptr, cur_size);
292+
kunmap_atomic(kaddr);
292293

293294
i++;
294295
ptr += cur_size;

0 commit comments

Comments
 (0)