Skip to content

Commit

Permalink
[PATCH] freevxfs: fix buffer_head leak
Browse files Browse the repository at this point in the history
- 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: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Pekka Enberg authored and Linus Torvalds committed Jun 30, 2005
1 parent f220ab2 commit ba03bda
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions fs/freevxfs/vxfs_fshead.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,18 @@ vxfs_getfsh(struct inode *ip, int which)
struct buffer_head *bp;

bp = vxfs_bread(ip, which);
if (buffer_mapped(bp)) {
if (bp) {
struct vxfs_fsh *fhp;

if (!(fhp = kmalloc(sizeof(*fhp), SLAB_KERNEL)))
return NULL;
if (!(fhp = kmalloc(sizeof(*fhp), GFP_KERNEL)))
goto out;
memcpy(fhp, bp->b_data, sizeof(*fhp));

brelse(bp);
put_bh(bp);
return (fhp);
}

out:
brelse(bp);
return NULL;
}

Expand Down

0 comments on commit ba03bda

Please sign in to comment.