summaryrefslogtreecommitdiff
path: root/fs/bcachefs/io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-09-07 13:16:41 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:26 -0400
commitb50dd7920d1cd7b37016929faa175578de12dd27 (patch)
treeb1be5a83eabba7094c5e332db790c60817c69ee5 /fs/bcachefs/io.c
parent89b0511826c1bde65f57a2e051ee9fcb274bff69 (diff)
downloadlwn-b50dd7920d1cd7b37016929faa175578de12dd27.tar.gz
lwn-b50dd7920d1cd7b37016929faa175578de12dd27.zip
bcachefs: Fix a null ptr deref
rbio->c wasn't being initialized in the move path Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/io.c')
-rw-r--r--fs/bcachefs/io.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 844ae46cd7eb..b0bff54a18e2 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -1218,10 +1218,15 @@ static inline struct bch_read_bio *bch2_rbio_free(struct bch_read_bio *rbio)
return rbio;
}
+/*
+ * Only called on a top level bch_read_bio to complete an entire read request,
+ * not a split:
+ */
static void bch2_rbio_done(struct bch_read_bio *rbio)
{
- bch2_time_stats_update(&rbio->c->times[BCH_TIME_data_read],
- rbio->start_time);
+ if (rbio->start_time)
+ bch2_time_stats_update(&rbio->c->times[BCH_TIME_data_read],
+ rbio->start_time);
bio_endio(&rbio->bio);
}