All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Chen Wandun <chenwandun@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: ngupta@vflare.org, sergey.senozhatsky.work@gmail.com,
	axboe@kernel.dk, linux-kernel@vger.kernel.org,
	linux-block@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] zram: fix race between backing_dev_show and backing_dev_store
Date: Tue, 15 Oct 2019 13:25:05 -0700	[thread overview]
Message-ID: <20191015202505.GA246210@google.com> (raw)
In-Reply-To: <1571046839-16814-1-git-send-email-chenwandun@huawei.com>

On Mon, Oct 14, 2019 at 05:53:59PM +0800, Chen Wandun wrote:
> From: Chenwandun <chenwandun@huawei.com>
> 
> CPU0:				       CPU1:
> backing_dev_show		       backing_dev_store
>     ......				   ......
>     file = zram->backing_dev;
>     down_read(&zram->init_lock);	   down_read(&zram->init_init_lock)
>     file_path(file, ...);		   zram->backing_dev = backing_dev;
>     up_read(&zram->init_lock);		   up_read(&zram->init_lock);
> 
> get the value of zram->backing_dev too early in backing_dev_show,
> that will result the value may be NULL at the begining, and not
> NULL later.
> 
> backtrace:
> [<ffffff8570e0f3ec>] d_path+0xcc/0x174
> [<ffffff8570decd90>] file_path+0x10/0x18
> [<ffffff85712f7630>] backing_dev_show+0x40/0xb4
> [<ffffff85712c776c>] dev_attr_show+0x20/0x54
> [<ffffff8570e835e4>] sysfs_kf_seq_show+0x9c/0x10c
> [<ffffff8570e82b98>] kernfs_seq_show+0x28/0x30
> [<ffffff8570e1c580>] seq_read+0x184/0x488
> [<ffffff8570e81ec4>] kernfs_fop_read+0x5c/0x1a4
> [<ffffff8570dee0fc>] __vfs_read+0x44/0x128
> [<ffffff8570dee310>] vfs_read+0xa0/0x138
> [<ffffff8570dee860>] SyS_read+0x54/0xb4
> 
> Signed-off-by: Chenwandun <chenwandun@huawei.com>

It should be stable material.
Cc: <stable@vger.kernel.org> [4.14+]
Acked-by: Minchan Kim <minchan@kernel.org>

Thanks!

      reply	other threads:[~2019-10-15 20:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-14  9:53 [PATCH] zram: fix race between backing_dev_show and backing_dev_store Chen Wandun
2019-10-15 20:25 ` Minchan Kim [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191015202505.GA246210@google.com \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=chenwandun@huawei.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.