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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1366059610.3824.25.camel@misato.fc.hp.com>
Date:	Mon, 15 Apr 2013 15:00:10 -0600
From:	Toshi Kani <toshi.kani@...com>
To:	Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>
Cc:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, wency@...fujitsu.com, tangchen@...fujitsu.com
Subject: Re: [PATCH] firmware, memmap: fix firmware_map_entry leak

On Mon, 2013-04-15 at 14:48 +0900, Yasuaki Ishimatsu wrote:
> When hot removing a memory, a firmware_map_entry which has memory range
> of the memory is released by release_firmware_map_entry(). If the entry
> is allocated by bootmem, release_firmware_map_entry() adds the entry to
> map_entires_bootmem list when firmware_map_find_entry() finds the entry
> from map_entries list. But firmware_map_find_entry never find the entry
> sicne map_entires list does not have the entry. So the entry just leaks.
> 
> Here are steps of leaking firmware_map_entry:
> firmware_map_remove()
> -> firmware_map_find_entry()
>    Find released entry from map_entries list
> -> firmware_map_remove_entry()
>    Delete the entry from map_entries list
> -> remove_sysfs_fw_map_entry()
>    ...
>    -> release_firmware_map_entry()
>       -> firmware_map_find_entry()
>          Find the entry from map_entries list but the entry has been
>          deleted from map_entries list. So the entry is not added
>          to map_entries_bootmem. Thus the entry leaks
> 
> release_firmware_map_entry() should not call firmware_map_find_entry()
> since releaed entry has been deleted from map_entries list.
> So the patch delete firmware_map_find_entry() from releae_firmware_map_entry()
> 
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>

Acked-by: Toshi Kani <toshi.kani@...com>

Thanks,
-Toshi


> ---
>  drivers/firmware/memmap.c |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
> index 0b5b5f6..e2e04b0 100644
> --- a/drivers/firmware/memmap.c
> +++ b/drivers/firmware/memmap.c
> @@ -114,12 +114,9 @@ static void __meminit release_firmware_map_entry(struct kobject *kobj)
>  		 * map_entries_bootmem here, and deleted from &map_entries in
>  		 * firmware_map_remove_entry().
>  		 */
> -		if (firmware_map_find_entry(entry->start, entry->end,
> -		    entry->type)) {
> -			spin_lock(&map_entries_bootmem_lock);
> -			list_add(&entry->list, &map_entries_bootmem);
> -			spin_unlock(&map_entries_bootmem_lock);
> -		}
> +		spin_lock(&map_entries_bootmem_lock);
> +		list_add(&entry->list, &map_entries_bootmem);
> +		spin_unlock(&map_entries_bootmem_lock);
>  
>  		return;
>  	}
> 


--
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