On Wed, May 23, 2018 at 11:22:20AM +0300, Nikolay Borisov wrote:
>
>
> On 23.05.2018 11:06, Su Yue wrote:
> > Commit 5a5003df98d5 ("btrfs: delayed-ref: double free in
> > btrfs_add_delayed_tree_ref()") fixed double free problem by creating
> > an unnessesary label to jump.
> > The elegant way is just to change "ref" to "head_ref" and keep
> > btrfs_add_delayed_tree_ref() and btrfs_add_delayed_data_ref() in
> > similar structure.
>
> I agree, personally I'm a fan of multiple returns rather than jump
> labels, because at this point you know the function terminates and
> that's it.
Ok, let's do the freeing in-place, but it would be better to put them
before any other code, which is init_delayed_ref_common() in this case.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html