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: <YKVtYfOM3RkS3gQh@google.com>
Date:   Wed, 19 May 2021 12:56:17 -0700
From:   Minchan Kim <minchan@...nel.org>
To:     Luis Chamberlain <mcgrof@...nel.org>
Cc:     ngupta@...are.org, sergey.senozhatsky.work@...il.com,
        axboe@...nel.dk, mbenes@...e.com, jpoimboe@...hat.com,
        tglx@...utronix.de, keescook@...omium.org, jikos@...nel.org,
        rostedt@...dmis.org, peterz@...radead.org,
        linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/4] zram: avoid disksize setting when device is being
 claimed

On Fri, Apr 23, 2021 at 01:11:06AM +0000, Luis Chamberlain wrote:
> As with other areas of the zram diver, check if the zram
> block device is being claimed but do it early to avoid
> trying to set something up for a zram device which may
> be on its way out.

I guess you're talking about zram_remove race with disksize_store.
Please add some code sequence diagram like previous patch, which
makes thing more clear.

Otherwise, looks good to me.

> 
> This doesn't fix a known crash, however the potential for
> an issue issue is found through code inspection.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
> ---
>  drivers/block/zram/zram_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 431b60cd85c1..6051d20b88c3 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -1729,7 +1729,7 @@ static ssize_t disksize_store(struct device *dev,
>  
>  	mutex_lock(&zram_index_mutex);
>  
> -	if (!zram_up) {
> +	if (!zram_up || zram->claim) {
>  		err = -ENODEV;
>  		goto out;
>  	}
> -- 
> 2.27.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ