From: Andrew Morton <akpm@osdl.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: penberg@cs.helsinki.fi, hch@infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] freevxfs: fix buffer_head leak
Date: Wed, 29 Jun 2005 00:21:39 -0700 [thread overview]
Message-ID: <20050629002139.6acd4be7.akpm@osdl.org> (raw)
In-Reply-To: <20050629071023.GD16850@infradead.org>
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;
}
_
next prev parent reply other threads:[~2005-06-29 7:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <iit0gm.lxobpl.5z2b9jduhy9fvx6tjxrco46v4.refire@cs.helsinki.fi>
2005-06-28 23:28 ` Andrew Morton
2005-06-29 4:25 ` Pekka Enberg
2005-06-29 7:10 ` Christoph Hellwig
2005-06-29 7:21 ` Andrew Morton [this message]
[not found] ` <iit0h1.q7pnex.bkir3xysppdufw6d9h65boz37.refire@cs.helsinki.fi>
2005-06-28 23:31 ` [PATCH 2/3] freevxfs: minor cleanups Andrew Morton
2005-06-29 4:20 ` Pekka Enberg
2005-06-29 7:08 ` Christoph Hellwig
2005-06-29 7:42 ` Pekka J Enberg
2005-06-29 7:50 ` Christoph Hellwig
2005-06-29 7:32 ` [PATCH 2/3] " Matthias Urlichs
2005-06-29 7:58 ` Pekka Enberg
2005-06-29 7:07 ` Christoph Hellwig
2005-06-29 7:17 ` Andrew Morton
2005-06-29 7:21 ` Christoph Hellwig
2005-06-29 7:39 ` Matthias Urlichs
2005-06-29 7:51 ` Pekka J Enberg
2005-06-29 10:23 ` Roman Zippel
[not found] ` <iit0hc.owmgrf.a8mlfisjmja2ab31fpl1ysmkp.refire@cs.helsinki.fi>
2005-06-28 23:33 ` [PATCH 3/3] freevxfs: remove 2.4 compatability Andrew Morton
2005-06-29 7:07 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050629002139.6acd4be7.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®