]> www.infradead.org Git - users/willy/xarray.git/commitdiff
bcachefs: Fix null ptr deref in journal_pins_to_text()
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 23 Jun 2024 16:07:07 +0000 (12:07 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 23 Jun 2024 16:07:07 +0000 (12:07 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal.c

index dac2f498ae8b61806ce8a27f315bbd2a9487f151..13669dd0e37561ca675676a9fe84b81b8a000a26 100644 (file)
@@ -1521,6 +1521,11 @@ bool bch2_journal_seq_pins_to_text(struct printbuf *out, struct journal *j, u64
        struct journal_entry_pin *pin;
 
        spin_lock(&j->lock);
+       if (!test_bit(JOURNAL_running, &j->flags)) {
+               spin_unlock(&j->lock);
+               return true;
+       }
+
        *seq = max(*seq, j->pin.front);
 
        if (*seq >= j->pin.back) {