LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [patch] freevxfs: possible null pointer dereference fix
@ 2007-02-20  7:58 Dmitriy Monakhov
  2007-02-20  8:00 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitriy Monakhov @ 2007-02-20  7:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: hch

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]

sb_read may return NULL, so let's explicitly check it.
Signed-off-by: Dmitriy Monakhov <dmonakhov@openvz.org>
-------------

[-- Attachment #2: diff-mm-freevxfs-sb_read-errh-fix --]
[-- Type: text/plain, Size: 903 bytes --]

diff --git a/fs/freevxfs/vxfs_bmap.c b/fs/freevxfs/vxfs_bmap.c
index 2d71128..f86fd3c 100644
--- a/fs/freevxfs/vxfs_bmap.c
+++ b/fs/freevxfs/vxfs_bmap.c
@@ -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) +
diff --git a/fs/freevxfs/vxfs_inode.c b/fs/freevxfs/vxfs_inode.c
index 098a915..d1f7c5b 100644
--- a/fs/freevxfs/vxfs_inode.c
+++ b/fs/freevxfs/vxfs_inode.c
@@ -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;
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] freevxfs: possible null pointer dereference fix
  2007-02-20  7:58 [patch] freevxfs: possible null pointer dereference fix Dmitriy Monakhov
@ 2007-02-20  8:00 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2007-02-20  8:00 UTC (permalink / raw)
  To: Dmitriy Monakhov; +Cc: linux-kernel, hch

On Tue, Feb 20, 2007 at 10:58:08AM +0300, Dmitriy Monakhov wrote:
> sb_read may return NULL, so let's explicitly check it.
> Signed-off-by: Dmitriy Monakhov <dmonakhov@openvz.org>

Ok.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-20  8:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-20  7:58 [patch] freevxfs: possible null pointer dereference fix Dmitriy Monakhov
2007-02-20  8:00 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).