From: Dan Carpenter <dan.carpenter@oracle.com>
To: Miao Xie <miaox@cn.fujitsu.com>
Cc: Chris Mason <chris.mason@fusionio.com>,
linux-btrfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] btrfs/raid56: fix and cleanup some error paths
Date: Mon, 22 Jul 2013 16:02:55 +0300 [thread overview]
Message-ID: <20130722130255.GH5636@mwanda> (raw)
In-Reply-To: <51ECF184.9030305@cn.fujitsu.com>
On Mon, Jul 22, 2013 at 04:47:00PM +0800, Miao Xie wrote:
> On mon, 22 Jul 2013 09:55:15 +0300, Dan Carpenter wrote:
> > The alloc_rbio() frees "raid_map" and "bbio" on error, so there is a
> > potential double free bug in raid56_parity_write(). The
> > raid56_parity_write() and raid56_parity_recover() functions should still
> > free "raid_map" and "bbio" on error if other errors occur though, so I
> > have added some more calls to kfree().
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> >From the viewpoint of the readability, it is better to free raid_map and bbio
> in the caller, I think. But it is up to you.
Normally, yes, you are right, but in this case the code makes sense
as is. We would have to free it in btrfs_map_bio() but we actually
allocate it in __btrfs_map_block(). It would be just as weird as
the current code.
The current code is not ugly, it's just that complicated things
require complicated code.
regards,
dan carpenter
prev parent reply other threads:[~2013-07-22 13:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-22 6:55 [patch] btrfs/raid56: fix and cleanup some error paths Dan Carpenter
2013-07-22 8:47 ` Miao Xie
2013-07-22 13:02 ` Dan Carpenter [this message]
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=20130722130255.GH5636@mwanda \
--to=dan.carpenter@oracle.com \
--cc=chris.mason@fusionio.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=miaox@cn.fujitsu.com \
/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;
as well as URLs for NNTP newsgroup(s).