mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
[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 <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
f220ab2a51
commit
ba03bda81e
1 changed files with 6 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue