mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 10:45:49 +00:00
bcachefs: fix integer underflow in journal code
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
28062d320b
commit
8db2acde2f
@ -256,6 +256,8 @@ static int journal_entry_open(struct journal *j)
|
||||
do {
|
||||
old.v = new.v = v;
|
||||
|
||||
EBUG_ON(journal_state_count(new, new.idx));
|
||||
|
||||
if (old.cur_entry_offset == JOURNAL_ENTRY_ERROR_VAL)
|
||||
return -EROFS;
|
||||
|
||||
@ -429,7 +431,7 @@ void bch2_journal_entry_res_resize(struct journal *j,
|
||||
if (d <= 0)
|
||||
goto out;
|
||||
|
||||
j->cur_entry_u64s -= d;
|
||||
j->cur_entry_u64s = max_t(int, 0, j->cur_entry_u64s - d);
|
||||
smp_mb();
|
||||
state = READ_ONCE(j->reservations);
|
||||
|
||||
|
@ -292,6 +292,8 @@ static inline int journal_res_get_fast(struct journal *j,
|
||||
if (new.cur_entry_offset + res->u64s > j->cur_entry_u64s)
|
||||
return 0;
|
||||
|
||||
EBUG_ON(!journal_state_count(new, new.idx));
|
||||
|
||||
if (flags & JOURNAL_RES_GET_CHECK)
|
||||
return 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user