jfs: fix array-index-out-of-bounds read in add_missing_indices
authorAditya Dutt <duttaditya18@gmail.com>
Tue, 1 Apr 2025 15:29:16 +0000 (20:59 +0530)
committerDave Kleikamp <dave.kleikamp@oracle.com>
Thu, 3 Apr 2025 14:11:43 +0000 (09:11 -0500)
commit5dff41a86377563f7a2b968aae00d25b4ceb37c9
treeb8722159c5128915b49ea43a56fb58252abc5aee
parenta4685408ff6c3e2af366ad9a7274f45ff3f394ee
jfs: fix array-index-out-of-bounds read in add_missing_indices

stbl is s8 but it must contain offsets into slot which can go from 0 to
127.

Added a bound check for that error and return -EIO if the check fails.
Also make jfs_readdir return with error if add_missing_indices returns
with an error.

Reported-by: syzbot+b974bd41515f770c608b@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com./bug?extid=b974bd41515f770c608b
Signed-off-by: Aditya Dutt <duttaditya18@gmail.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
fs/jfs/jfs_dtree.c