diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2005-06-30 05:59:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-30 11:45:12 -0400 |
commit | ba03bda81e160b2724451074cdcb597d14f7d7e0 (patch) | |
tree | 5a4b9a7a39a08f01656d4eda549ecc6fee80f822 /fs/freevxfs | |
parent | f220ab2a5162c35cca6993ea473937cfc962fce4 (diff) |
[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: 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>
Diffstat (limited to 'fs/freevxfs')
-rw-r--r-- | fs/freevxfs/vxfs_fshead.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/freevxfs/vxfs_fshead.c b/fs/freevxfs/vxfs_fshead.c index 05b19f70bf97..6dee109aeea4 100644 --- a/fs/freevxfs/vxfs_fshead.c +++ b/fs/freevxfs/vxfs_fshead.c | |||
@@ -78,17 +78,18 @@ vxfs_getfsh(struct inode *ip, int which) | |||
78 | struct buffer_head *bp; | 78 | struct buffer_head *bp; |
79 | 79 | ||
80 | bp = vxfs_bread(ip, which); | 80 | bp = vxfs_bread(ip, which); |
81 | if (buffer_mapped(bp)) { | 81 | if (bp) { |
82 | struct vxfs_fsh *fhp; | 82 | struct vxfs_fsh *fhp; |
83 | 83 | ||
84 | if (!(fhp = kmalloc(sizeof(*fhp), SLAB_KERNEL))) | 84 | if (!(fhp = kmalloc(sizeof(*fhp), GFP_KERNEL))) |
85 | return NULL; | 85 | goto out; |
86 | memcpy(fhp, bp->b_data, sizeof(*fhp)); | 86 | memcpy(fhp, bp->b_data, sizeof(*fhp)); |
87 | 87 | ||
88 | brelse(bp); | 88 | put_bh(bp); |
89 | return (fhp); | 89 | return (fhp); |
90 | } | 90 | } |
91 | 91 | out: | |
92 | brelse(bp); | ||
92 | return NULL; | 93 | return NULL; |
93 | } | 94 | } |
94 | 95 | ||