[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00000000000096207606187400e6@google.com>
Date: Tue, 14 May 2024 18:26:05 -0700
From: syzbot <syzbot+249018ea545364f78d04@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org
Subject: Re: [syzbot] [PATCH] guard against unknown r->data_type in bch2_sb_dev_has_data()
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org.
***
Subject: [PATCH] guard against unknown r->data_type in bch2_sb_dev_has_data()
Author: cam.alvarez.i@...il.com
#syz test
Shift is perfomed only when the data type makes sense.
Fix a missing guard on r->data_type being known.
Signed-off-by: Camila Alvarez <cam.alvarez.i@...il.com>
---
fs/bcachefs/replicas.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/bcachefs/replicas.c b/fs/bcachefs/replicas.c
index 678b9c20e251..0fa91d0bf951 100644
--- a/fs/bcachefs/replicas.c
+++ b/fs/bcachefs/replicas.c
@@ -1006,14 +1006,14 @@ unsigned bch2_sb_dev_has_data(struct bch_sb *sb, unsigned dev)
for_each_replicas_entry(replicas, r)
for (i = 0; i < r->nr_devs; i++)
- if (r->devs[i] == dev)
+ if (r->devs[i] == dev && r->data_type < BCH_DATA_NR)
data_has |= 1 << r->data_type;
} else if (replicas_v0) {
struct bch_replicas_entry_v0 *r;
for_each_replicas_entry_v0(replicas_v0, r)
for (i = 0; i < r->nr_devs; i++)
- if (r->devs[i] == dev)
+ if (r->devs[i] == dev && r->data_type < BCH_DATA_NR)
data_has |= 1 << r->data_type;
}
--
2.34.1
Powered by blists - more mailing lists