Skip to content

Commit

Permalink
freevxfs: possible null pointer dereference fix
Browse files Browse the repository at this point in the history
sb_read may return NULL, so let's explicitly check it.

Signed-off-by: Dmitriy Monakhov <[email protected]>
Acked-by: Christoph Hellwig <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Dmitriy Monakhov authored and Linus Torvalds committed May 8, 2007
1 parent 1368c4f commit 82f703b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fs/freevxfs/vxfs_bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) +
Expand Down
2 changes: 1 addition & 1 deletion fs/freevxfs/vxfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 82f703b

Please sign in to comment.