Re: [PATCH] Btrfs: fix use-after-free when cloning a trailing file hole

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 29, 2014 at 8:23 PM, Chris Mason <clm@xxxxxx> wrote:
> On 06/29/2014 03:43 PM, Filipe David Borba Manana wrote:
>> The transaction handle was being used after being freed.
>>
>> Cc: Chris Mason <clm@xxxxxx>
>> Signed-off-by: Filipe David Borba Manana <fdmanana@xxxxxxxxx>
>> ---
>>  fs/btrfs/ioctl.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
>> index 02dc64b..2562dc7 100644
>> --- a/fs/btrfs/ioctl.c
>> +++ b/fs/btrfs/ioctl.c
>> @@ -3565,12 +3565,10 @@ process_slot:
>>                       btrfs_end_transaction(trans, root);
>>                       goto out;
>>               }
>> -             ret = clone_finish_inode_update(trans, inode, destoff + len,
>> -                                             destoff, olen);
>> -             if (ret)
>> -                     goto out;
>>               clone_update_extent_map(inode, trans, path, NULL, last_dest_end,
>>                                       destoff + len - last_dest_end);
>> +             ret = clone_finish_inode_update(trans, inode, destoff + len,
>> +                                             destoff, olen);
>>       }
>>
>>  out:
>>
>
> What about the path?  It has been released, so it should either be NULL
> or we have other problems ;)

Hi Chris,

Not needed. clone_update_extent_map ignores path if its 4th argument
is NULL (which is the case here).
Either way it's more clear if path is passed to that function as NULL
too. I'll update it for clarity.

>
> -chris



-- 
Filipe David Manana,

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."
--
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




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux