diff options
author | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> | 2013-06-26 15:28:39 +0300 |
---|---|---|
committer | Ziyan <jaraidaniel@gmail.com> | 2016-01-05 18:21:14 +0100 |
commit | e21daa43cf74938ddcb35314cb91b895dbd84ca8 (patch) | |
tree | dae182359afe97d0b65d3c3c6ff007431fa1cb5e /drivers/staging | |
parent | 22c26ce9abbc9068cabc860648735efe6fd6e52e (diff) | |
download | kernel_samsung_tuna-e21daa43cf74938ddcb35314cb91b895dbd84ca8.zip kernel_samsung_tuna-e21daa43cf74938ddcb35314cb91b895dbd84ca8.tar.gz kernel_samsung_tuna-e21daa43cf74938ddcb35314cb91b895dbd84ca8.tar.bz2 |
staging: 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.
Change-Id: I93ce19f9b262584f4ef805dce5ed4de9b3968a30
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Jerome Marchand <jmarchand@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-commit: 644d478793c6594277f8ae76954da4ace7ac6f96
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/zram/zram_drv.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 5a795ca..d4f66e3 100644 --- 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) |