bcachefs: fix buffer overflow in nocow write path
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 30 Dec 2023 20:32:05 +0000 (15:32 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 1 Jan 2024 16:46:52 +0000 (11:46 -0500)
commitd9534cc9fc455214e857bc1d32f44d5a229dc602
tree514daea0e0ee9860e888f8b14b2d0a71ab593175
parent099dc5c29dff52c0c37abcaa6cc747a1ac8df5fe
bcachefs: fix buffer overflow in nocow write path

BCH_REPLICAS_MAX isn't the actual maximum number of pointers in an
extent, it's the maximum number of dirty pointers.

We don't have a real restriction on the number of cached pointers, and
we don't want a fixed size array here anyways - so switch to
DARRAY_PREALLOCATED().

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Reported-and-tested-by: Daniel J Blueman <daniel@quora.org>
fs/bcachefs/io_write.c