Thread (21 messages) 21 messages, 2 authors, 2021-06-22

Re: [PATCH v3 1/3] zram: fix crashes due to use of cpu hotplug multistate

From: Luis Chamberlain <mcgrof@kernel.org>
Date: 2021-06-22 15:12:19
Also in: lkml

On Tue, Jun 22, 2021 at 09:39:40AM +0200, Greg KH wrote:
On Mon, Jun 21, 2021 at 04:30:11PM -0700, Luis Chamberlain wrote:
quoted
CPU 1                            CPU 2

class_unregister(...);
Now the sysfs files are removed and invalidated for all devices
associated with that class.
You're right the disksize_store() would have to happen before.
quoted
idr_for_each(...);
zram_debugfs_destroy();
                                disksize_store(...);
How will this call into the kobject's store function if
class_unregister() has already happened?
The disksize_store() would indeed have to happen before.
quoted
idr_destroy(...);
unregister_blkdev(...);
Ah, it's a block device's store function you are worried about, not the
class one?
In this case its about any files which can change the cpu compression
streams.
quoted
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index cf8deecc39ef..431b60cd85c1 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -44,6 +44,8 @@ static DEFINE_MUTEX(zram_index_mutex);
 static int zram_major;
 static const char *default_compressor = CONFIG_ZRAM_DEF_COMP;
 
+bool zram_up;
static?
Will fix.
quoted
+
 /* Module params (documentation at end) */
 static unsigned int num_devices = 1;
 /*
@@ -1704,6 +1706,7 @@ static void zram_reset_device(struct zram *zram)
 	comp = zram->comp;
 	disksize = zram->disksize;
 	zram->disksize = 0;
+	zram->comp = NULL;
Is this a new change?
It is a sanity change, but indeed, it is separate. I'll let Minchan
decide if he would prefer this to go out as a separate change.

  Luis
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help