projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f2a6fed
)
staging: zram: protect zram_reset_device() call
author
Sergey Senozhatsky
<
[email protected]
>
Wed, 26 Jun 2013 12:28:39 +0000
(15:28 +0300)
committer
Greg Kroah-Hartman
<
[email protected]
>
Tue, 23 Jul 2013 22:08:50 +0000
(15:08 -0700)
Commit
9b3bb7abcdf2df0f1b2657e6cbc9d06bc2b3b36f
(remove
zram_sysfs file (v2)) accidentally made zram_reset_device()
racy. Protect zram_reset_device() call with zram->lock.
Signed-off-by: Sergey Senozhatsky <
[email protected]
>
Acked-by: Jerome Marchand <
[email protected]
>
Signed-off-by: Greg Kroah-Hartman <
[email protected]
>
drivers/staging/zram/zram_drv.c
patch
|
blob
|
history
diff --git
a/drivers/staging/zram/zram_drv.c
b/drivers/staging/zram/zram_drv.c
index 82c7202fd5cc963668dc8e74caf7dfce11e8f66a..e77fb6ea40c905f3cb72571ef3ca424b44b37440 100644
(file)
--- a/
drivers/staging/zram/zram_drv.c
+++ b/
drivers/staging/zram/zram_drv.c
@@
-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)