diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index ab11849cf9cc..c200b37f4562 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c @@ -2129,11 +2129,17 @@ int dtDelete(tid_t tid, next_index = -1; else { stbl = DT_GETSTBL(np); - ldtentry = - (struct ldtentry *) & np-> - slot[stbl[0]]; - next_index = - le32_to_cpu(ldtentry->index); + if (stbl[0] < 0 || stbl[0] >= DTPAGEMAXSLOT) { + jfs_err("JFS: Invalid stbl[0] = %d for inode %ld, block = %lld", + stbl[0], (long)ip->i_ino, (long long)le64_to_cpu(p->header.next)); + next_index = -1; + } else { + ldtentry = + (struct ldtentry *) & np-> + slot[stbl[0]]; + next_index = + le32_to_cpu(ldtentry->index); + } DT_PUTPAGE(nmp); } }