diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-05-22 19:53:03 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-05-22 19:54:03 -0400 |
commit | d293ece108104967ec3465f253834c0511170f04 (patch) | |
tree | 1848e1432111bf4c7ec122973808d81a1673ae38 /fs/bcachefs/printbuf.c | |
parent | 2195b755ebd23992c5758d2d02a8080eac2baeca (diff) |
bcachefs: Fix shutdown ordering
the btree key cache uses the srcu struct created/destroyed by
btree_iter.c; btree_iter needs to be exited last.
Reported-by: syzbot+3af9daea347788b15213@syzkaller.appspotmail.com
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/printbuf.c')
-rw-r--r-- | fs/bcachefs/printbuf.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/bcachefs/printbuf.c b/fs/bcachefs/printbuf.c index 8b0369185f5c..9f529e4c1b16 100644 --- a/fs/bcachefs/printbuf.c +++ b/fs/bcachefs/printbuf.c @@ -45,6 +45,13 @@ int bch2_printbuf_make_room(struct printbuf *out, unsigned extra) unsigned new_size = roundup_pow_of_two(out->size + extra); + /* Sanity check... */ + if (new_size > PAGE_SIZE << MAX_PAGE_ORDER) { + out->allocation_failure = true; + out->overflow = true; + return -ENOMEM; + } + /* * Note: output buffer must be freeable with kfree(), it's not required * that the user use printbuf_exit(). |