* [PATCH staging-next] zram: protect zram_reset_device() call
@ 2013-06-26 12:28 Sergey Senozhatsky
2013-07-03 9:37 ` Jerome Marchand
0 siblings, 1 reply; 4+ messages in thread
From: Sergey Senozhatsky @ 2013-06-26 12:28 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Nitin Gupta, linux-kernel
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 <sergey.senozhatsky@gmail.com>
---
drivers/staging/zram/zram_drv.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 82c7202..e77fb6e 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)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH staging-next] zram: protect zram_reset_device() call
2013-06-26 12:28 [PATCH staging-next] zram: protect zram_reset_device() call Sergey Senozhatsky
@ 2013-07-03 9:37 ` Jerome Marchand
2013-07-12 13:46 ` Sergey Senozhatsky
0 siblings, 1 reply; 4+ messages in thread
From: Jerome Marchand @ 2013-07-03 9:37 UTC (permalink / raw)
To: Sergey Senozhatsky; +Cc: Greg Kroah-Hartman, Nitin Gupta, linux-kernel
On 06/26/2013 02:28 PM, Sergey Senozhatsky wrote:
> 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 <sergey.senozhatsky@gmail.com>
Acked-by: Jerome Marchand <jmarchand@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH staging-next] zram: protect zram_reset_device() call
2013-07-03 9:37 ` Jerome Marchand
@ 2013-07-12 13:46 ` Sergey Senozhatsky
2013-07-12 14:48 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Sergey Senozhatsky @ 2013-07-12 13:46 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Sergey Senozhatsky, Jerome Marchand, Nitin Gupta, linux-kernel
On (07/03/13 11:37), Jerome Marchand wrote:
> 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
>
> On 06/26/2013 02:28 PM, Sergey Senozhatsky wrote:
> > 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 <sergey.senozhatsky@gmail.com>
>
> Acked-by: Jerome Marchand <jmarchand@redhat.com>
Hello Greg,
could you please apply this patch?
thank you,
-ss
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH staging-next] zram: protect zram_reset_device() call
2013-07-12 13:46 ` Sergey Senozhatsky
@ 2013-07-12 14:48 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-12 14:48 UTC (permalink / raw)
To: Sergey Senozhatsky; +Cc: Jerome Marchand, Nitin Gupta, linux-kernel
On Fri, Jul 12, 2013 at 04:46:29PM +0300, Sergey Senozhatsky wrote:
> On (07/03/13 11:37), Jerome Marchand wrote:
> > 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
> >
> > On 06/26/2013 02:28 PM, Sergey Senozhatsky wrote:
> > > 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 <sergey.senozhatsky@gmail.com>
> >
> > Acked-by: Jerome Marchand <jmarchand@redhat.com>
>
> Hello Greg,
> could you please apply this patch?
After the merge window is closed I will get to it, thanks.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-07-12 14:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-26 12:28 [PATCH staging-next] zram: protect zram_reset_device() call Sergey Senozhatsky
2013-07-03 9:37 ` Jerome Marchand
2013-07-12 13:46 ` Sergey Senozhatsky
2013-07-12 14:48 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox