freevxfs: possible null pointer dereference fix
authorDmitriy Monakhov <dmonakhov@sw.ru>
Tue, 8 May 2007 07:24:34 +0000 (00:24 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 8 May 2007 18:14:59 +0000 (11:14 -0700)
sb_read may return NULL, so let's explicitly check it.

Signed-off-by: Dmitriy Monakhov <dmonakhov@openvz.org>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/freevxfs/vxfs_bmap.c
fs/freevxfs/vxfs_inode.c

index 2d71128bd8d6b3503098b25039e30e183cd23ab5..f86fd3cacd5ab77f6741ce9fcb1dc2d8ee746c01 100644 (file)
@@ -137,7 +137,7 @@ vxfs_bmap_indir(struct inode *ip, long indir, int size, long block)
 
                bp = sb_bread(ip->i_sb,
                                indir + (i / VXFS_TYPED_PER_BLOCK(ip->i_sb)));
-               if (!buffer_mapped(bp))
+               if (!bp || !buffer_mapped(bp))
                        return 0;
 
                typ = ((struct vxfs_typed *)bp->b_data) +
index 098a915fd9a1da65aeb0902350bee828fab46996..d1f7c5b5b3c350d0656a4f33b7d841b4f450e1b3 100644 (file)
@@ -99,7 +99,7 @@ vxfs_blkiget(struct super_block *sbp, u_long extent, ino_t ino)
        offset = ((ino % (sbp->s_blocksize / VXFS_ISIZE)) * VXFS_ISIZE);
        bp = sb_bread(sbp, block);
 
-       if (buffer_mapped(bp)) {
+       if (bp && buffer_mapped(bp)) {
                struct vxfs_inode_info  *vip;
                struct vxfs_dinode      *dip;