lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 07 Dec 2014 15:26:53 +0200
From:	Tanya Brokhman <tlinder@...eaurora.org>
To:	Richard Weinberger <richard@....at>, dedekind1@...il.com
CC:	linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/6] UBI: Fastmap: Fix memory leaks while closing the
 WL sub-system

On 12/7/2014 1:34 PM, Richard Weinberger wrote:
> Am 07.12.2014 um 12:32 schrieb Tanya Brokhman:
>> On 12/7/2014 11:54 AM, Richard Weinberger wrote:
>>> Am 07.12.2014 um 09:13 schrieb Tanya Brokhman:
>>>> On 11/30/2014 1:35 PM, Richard Weinberger wrote:
>>>>> Add a ubi_fastmap_close() to free all resources used by fastmap
>>>>> at WL shutdown.
>>>>>
>>>>> Signed-off-by: Richard Weinberger <richard@....at>
>>>>> ---
>>>>>     drivers/mtd/ubi/wl.c | 21 ++++++++++++++++++---
>>>>>     1 file changed, 18 insertions(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
>>>>> index c2822f7..47b215f 100644
>>>>> --- a/drivers/mtd/ubi/wl.c
>>>>> +++ b/drivers/mtd/ubi/wl.c
>>>>> @@ -2064,6 +2064,23 @@ static void protection_queue_destroy(struct ubi_device *ubi)
>>>>>         }
>>>>>     }
>>>>>
>>>>> +static void ubi_fastmap_close(struct ubi_device *ubi)
>>>>> +{
>>>>> +#ifdef CONFIG_MTD_UBI_FASTMAP
>>>>> +    int i;
>>>>> +
>>>>> +    flush_work(&ubi->fm_work);
>>>>> +    return_unused_pool_pebs(ubi, &ubi->fm_pool);
>>>>> +    return_unused_pool_pebs(ubi, &ubi->fm_wl_pool);
>>>>> +
>>>>> +    if (ubi->fm) {
>>>>> +        for (i = 0; i < ubi->fm->used_blocks; i++)
>>>>> +            kfree(ubi->fm->e[i]);
>>>>> +    }
>>>>> +    kfree(ubi->fm);
>>>>
>>>> kfree(ubi->fm_buf)?
>>>
>>> No this is not a typo, I kfree() here ubi->fm by design.
>>> What am I missing? :)
>>
>> I think you missed freeing ubi->fm_buf, before (not instead) you free ubi->fm :)
>
> No. fm_buf is vfree()d upon detach time.

you're right, found it at ubi_detach_mtd_dev() several lines after 
calling ubi_wl_close(). But if you're creating a fastmap-close dedicated 
function, fm_buf should be freed in it as it is fastmap related.

>
> Thanks,
> //richard
>


Thanks,
Tanya Brokhman
-- 
Qualcomm Israel, on behalf of Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ