From: Luis Chamberlain <mcgrof@kernel.org>
To: minchan@kernel.org, ngupta@vflare.org, sergey.senozhatsky.work@gmail.com
Cc: mcgrof@kernel.org, axboe@kernel.dk, mbenes@suse.com,
jpoimboe@redhat.com, tglx@linutronix.de, keescook@chromium.org,
jikos@kernel.org, rostedt@goodmis.org, peterz@infradead.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/4] zram: avoid disksize setting when device is being claimed
Date: Fri, 23 Apr 2021 01:11:06 +0000 [thread overview]
Message-ID: <20210423011108.11988-3-mcgrof@kernel.org> (raw)
In-Reply-To: <20210423011108.11988-1-mcgrof@kernel.org>
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.
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@kernel.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
next prev parent reply other threads:[~2021-04-23 1:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 1:11 [PATCH v2 0/4] zram: fix few sysfs races Luis Chamberlain
2021-04-23 1:11 ` [PATCH v2 1/4] zram: fix crashes due to use of cpu hotplug multistate Luis Chamberlain
2021-05-19 19:54 ` Minchan Kim
2021-04-23 1:11 ` Luis Chamberlain [this message]
2021-05-19 19:56 ` [PATCH v2 2/4] zram: avoid disksize setting when device is being claimed Minchan Kim
2021-04-23 1:11 ` [PATCH v2 3/4] zram: fix deadlock with sysfs attribute usage and driver removal Luis Chamberlain
2021-04-23 1:11 ` [PATCH v2 4/4] zram: fix possible races between sysfs use and bdev access Luis Chamberlain
2021-05-19 20:09 ` [PATCH v2 0/4] zram: fix few sysfs races Minchan Kim
2021-05-19 20:20 ` Luis Chamberlain
2021-05-21 20:01 ` Greg Kroah-Hartman
2021-05-21 20:16 ` Luis Chamberlain
2021-05-21 20:45 ` Greg Kroah-Hartman
2021-05-21 21:08 ` Luis Chamberlain
2021-05-22 7:48 ` Greg Kroah-Hartman
2021-05-25 1:16 ` Luis Chamberlain
2021-05-25 7:41 ` Greg Kroah-Hartman
2021-06-21 23:19 ` Luis Chamberlain
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=20210423011108.11988-3-mcgrof@kernel.org \
--to=mcgrof@kernel.org \
--cc=axboe@kernel.dk \
--cc=jikos@kernel.org \
--cc=jpoimboe@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mbenes@suse.com \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).