summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/fs.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-10-27 14:10:52 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:45 -0400
commit527087c741dc1199fbf4a635a80bf4839a9a8288 (patch)
tree0af5f428647427a19bf37690429f02ba8e72d80e /fs/bcachefs/fs.c
parent8cad3e2f73f5c6ad39e9da5564382a2a737a201c (diff)
downloadlinux-stable-527087c741dc1199fbf4a635a80bf4839a9a8288.tar.gz
linux-stable-527087c741dc1199fbf4a635a80bf4839a9a8288.tar.bz2
linux-stable-527087c741dc1199fbf4a635a80bf4839a9a8288.zip
bcachefs: Fix stack corruption
A bkey_on_stack_realloc() call was in the wrong place, and broken for indirect extents Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fs.c')
-rw-r--r--fs/bcachefs/fs.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 5119266a8493..2ed80ef41d1a 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -921,9 +921,7 @@ retry:
bkey_start_offset(k.k);
sectors = k.k->size - offset_into_extent;
- bkey_on_stack_realloc(&cur, c, k.k->u64s);
- bkey_on_stack_realloc(&prev, c, k.k->u64s);
- bkey_reassemble(cur.k, k);
+ bkey_on_stack_reassemble(&cur, c, k);
ret = bch2_read_indirect_extent(&trans,
&offset_into_extent, &cur);
@@ -931,6 +929,7 @@ retry:
break;
k = bkey_i_to_s_c(cur.k);
+ bkey_on_stack_realloc(&prev, c, k.k->u64s);
sectors = min(sectors, k.k->size - offset_into_extent);