提交 ba03bda8 编写于 作者: P Pekka Enberg 提交者: Linus Torvalds

[PATCH] freevxfs: fix buffer_head leak

- fix a buffer_head leak in vxfs_getfsh()

- s/SLAB_KERNEL/GFP_KERNEL/

- check sb_bread() return value

- drop pointless buffer-mapped() test.
Signed-off-by: NPekka Enberg <penberg@cs.helsinki.fi>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 f220ab2a
...@@ -78,17 +78,18 @@ vxfs_getfsh(struct inode *ip, int which) ...@@ -78,17 +78,18 @@ vxfs_getfsh(struct inode *ip, int which)
struct buffer_head *bp; struct buffer_head *bp;
bp = vxfs_bread(ip, which); bp = vxfs_bread(ip, which);
if (buffer_mapped(bp)) { if (bp) {
struct vxfs_fsh *fhp; struct vxfs_fsh *fhp;
if (!(fhp = kmalloc(sizeof(*fhp), SLAB_KERNEL))) if (!(fhp = kmalloc(sizeof(*fhp), GFP_KERNEL)))
return NULL; goto out;
memcpy(fhp, bp->b_data, sizeof(*fhp)); memcpy(fhp, bp->b_data, sizeof(*fhp));
brelse(bp); put_bh(bp);
return (fhp); return (fhp);
} }
out:
brelse(bp);
return NULL; return NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册