diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index a3eb1e826947..61550223c954 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -1952,7 +1952,9 @@ dbAllocDmapLev(struct bmap * bmp,
         */
        if (dbFindLeaf((dmtree_t *) & dp->tree, l2nb, &leafidx))
                return -ENOSPC;
-
+               
+       if (leafidx < 0)
+               return -EIO;
        /* determine the block number within the file system corresponding
         * to the leaf at which free space was found.
         */