diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index 2ec35889ad24..977751b30489 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c @@ -881,6 +881,11 @@ int diFree(struct inode *ip) */ agno = BLKTOAG(JFS_IP(ip)->agstart, JFS_SBI(ip->i_sb)); + if(agno >= MAXAG){ + jfs_error(ip->i_sb, "invalid array index (agno >= MAXAG), agno = %d\n", agno); + return -ENOMEM; + } + /* Lock the AG specific inode map information */ AG_LOCK(imap, agno);