The length of the key maybe too large. Add a key length check before reading the key. Reported-and-tested-by: syzbot+c6811fc2262cec1e6266@xxxxxxxxxxxxxxxxxxxxxxxxx Closes: https://syzkaller.appspot.com/bug?extid=c6811fc2262cec1e6266 Signed-off-by: Edward Adam Davis <eadavis@xxxxxx> --- fs/hfs/bnode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c index 6add6ebfef89..6e38d61da36f 100644 --- a/fs/hfs/bnode.c +++ b/fs/hfs/bnode.c @@ -67,6 +67,9 @@ void hfs_bnode_read_key(struct hfs_bnode *node, void *key, int off) else key_len = tree->max_key_len + 1; + if (key_len > tree->max_key_len + 1) + return; + hfs_bnode_read(node, key, off, key_len); } -- 2.47.0