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]
Date:   Wed, 16 May 2018 17:53:49 +0100
From:   Ben Hutchings <ben.hutchings@...ethink.co.uk>
To:     Martin Townsend <mtownsend1973@...il.com>,
        Richard Weinberger <richard@....at>
Cc:     stable@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4.4 23/97] ubi: fastmap: Dont flush fastmap work on
 detach

On Sun, 2018-04-22 at 15:53 +0200, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Richard Weinberger <richard@....at>
> 
> commit 29b7a6fa1ec07e8480b0d9caf635a4498a438bf4 upstream.
> 
> At this point UBI volumes have already been free()'ed and fastmap can no
> longer access these data structures.

I don't see how this change can fix a use-after-free.  If this function
can be called with *ubi already freed, then the rest of the function
body is also not safe to run.  But I don't think that is the case.

ubi->fm_work doesn't depend on any other structure (except a global
workqueue, which won't go away).

It seems to me that the bug is really a race condition, and removing
the flush_work() makes it harder to hit that condition.  The proper fix
would be to call flush_work() (or cancel_work_sync()) before the UBI
volumes are freed.

Ben.

> Reported-by: Martin Townsend <mtownsend1973@...il.com>
> Fixes: 74cdaf24004a ("UBI: Fastmap: Fix memory leaks while closing the WL sub-system")
> Cc: stable@...r.kernel.org
> Signed-off-by: Richard Weinberger <richard@....at>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> 
> ---
>  drivers/mtd/ubi/fastmap-wl.c |    1 -
>  1 file changed, 1 deletion(-)
> 
> --- a/drivers/mtd/ubi/fastmap-wl.c
> +++ b/drivers/mtd/ubi/fastmap-wl.c
> @@ -360,7 +360,6 @@ static void ubi_fastmap_close(struct ubi
>  {
>  	int i;
>  
> -	flush_work(&ubi->fm_work);
>  	return_unused_pool_pebs(ubi, &ubi->fm_pool);
>  	return_unused_pool_pebs(ubi, &ubi->fm_wl_pool);
>  
> 
> 
> 
-- 
Ben Hutchings
Software Developer, Codethink Ltd.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ