zram: protect zram_reset_device() call
PATCH 1/1 zram: protect zram_reset_device() call
Commit 9b3bb7abcdf2df0f1b2657e6cbc9d06bc2b3b36f (remove zram_sysfs file (v2)) accidentally made zram_reset_device() racy. Protect zram_reset_device() call with zram->lock.
--- drivers/staging/zram/zram_drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/staging/zram/zram_drv.c +5 -1
@@ -527,8 +527,11 @@ static void zram_reset_device(struct zram *zram)size_t index;struct zram_meta *meta; -if (!zram->init_done) +down_write (&zram->init_lock); +if (!zram->init_done) { +up_write (&zram->init_lock);return ; + } meta = zram->meta; zram->init_done =0 ;
@@ -549,6 +552,7 @@ static void zram_reset_device(struct zram *zram) zram->disksize =0 ;set_capacity (zram->disk,0 ); +up_write (&zram->init_lock); }static void zram_init_device (struct zram *zram,struct zram_meta *meta)
Quoted 5 lines · Sergey Senozhatsky
Commit
9b3bb7abcdf2df0f1b2657e6cbc9d06bc2b3b36f(removezram_sysfsfile (v2)) accidentally madezram_reset_device()racy. Protectzram_reset_device()call withzram->lock.Signed-off-by Sergey Senozhatsky <[email protected]>
Quoted 4 lines · Jerome Marchand
Subject: Re: [PATCH staging-next] zram: protect
zram_reset_device()call
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110
Thunderbird/17.0.2
Quoted 8 lines
Quoted 5 lines · Sergey Senozhatsky
Commit
9b3bb7abcdf2df0f1b2657e6cbc9d06bc2b3b36f(removezram_sysfsfile (v2)) accidentally madezram_reset_device()racy. Protectzram_reset_device()call withzram->lock.Signed-off-by Sergey Senozhatsky <[email protected]>Acked-by Jerome Marchand <[email protected]>
Hello Greg,
could you please apply this patch?
thank you,
-ss
Greg Kroah-Hartman
maintainerQuoted 10 lines · Sergey Senozhatsky
Quoted 9 lines · Jerome Marchand
Subject: Re: [PATCH staging-next] zram: protect
zram_reset_device()call
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110
Thunderbird/17.0.2Quoted 4 lines · Sergey Senozhatsky
Commit
9b3bb7abcdf2df0f1b2657e6cbc9d06bc2b3b36f(removezram_sysfsfile (v2)) accidentally madezram_reset_device()racy. Protectzram_reset_device()call withzram->lock.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Sergey Senozhatsky <[email protected]>Acked-by Jerome Marchand <[email protected]>Hello Greg,
could you please apply this patch?
After the merge window is closed I will get to it, thanks.
greg k-h