Messages in this thread Patch in this message |  | | | Date | Wed, 29 Jun 2005 00:21:39 -0700 | | From | Andrew Morton <> | | Subject | Re: [PATCH 1/3] freevxfs: fix buffer_head leak |
| |
Christoph Hellwig <hch@infradead.org> wrote: > > you're still leaking a buffer in the hypothetical !buffer_mapped() case. > Better remove that check completely.
OK..
--- 25/fs/freevxfs/vxfs_fshead.c~freevxfs-fix-buffer_head-leak 2005-06-28 23:55:53.000000000 -0700 +++ 25-akpm/fs/freevxfs/vxfs_fshead.c 2005-06-29 00:21:23.000000000 -0700 @@ -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; } _ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |