<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/drivers/staging/zram, branch v3.13</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>Staging: zram: Fix memory leak by refcount mismatch</title>
<updated>2013-11-25T17:14:29+00:00</updated>
<author>
<name>Rashika Kheria</name>
<email>rashika.kheria@gmail.com</email>
</author>
<published>2013-11-10T16:43:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=1b672224d128ec2570eb37572ff803cfe452b4f7'/>
<id>1b672224d128ec2570eb37572ff803cfe452b4f7</id>
<content type='text'>
As suggested by Minchan Kim and Jerome Marchand "The code in reset_store
get the block device (bdget_disk()) but it does not put it (bdput()) when
it's done using it. The usage count is therefore incremented but never
decremented."

This patch also puts bdput() for all error cases.

Acked-by: Minchan Kim &lt;minchan@kernel.org&gt;
Acked-by: Jerome Marchand &lt;jmarchan@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Rashika Kheria &lt;rashika.kheria@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As suggested by Minchan Kim and Jerome Marchand "The code in reset_store
get the block device (bdget_disk()) but it does not put it (bdput()) when
it's done using it. The usage count is therefore incremented but never
decremented."

This patch also puts bdput() for all error cases.

Acked-by: Minchan Kim &lt;minchan@kernel.org&gt;
Acked-by: Jerome Marchand &lt;jmarchan@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Rashika Kheria &lt;rashika.kheria@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Staging: zram: Fix access of NULL pointer</title>
<updated>2013-10-30T16:36:53+00:00</updated>
<author>
<name>Rashika Kheria</name>
<email>rashika.kheria@gmail.com</email>
</author>
<published>2013-10-30T13:06:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=46a51c80216cb891f271ad021f59009f34677499'/>
<id>46a51c80216cb891f271ad021f59009f34677499</id>
<content type='text'>
This patch fixes the bug in reset_store caused by accessing NULL pointer.

The bdev gets its value from bdget_disk() which could fail when memory
pressure is severe and hence can return NULL because allocation of
inode in bdget could fail.

Hence, this patch introduces a check for bdev to prevent reference to a
NULL pointer in the later part of the code. It also removes unnecessary
check of bdev for fsync_bdev().

Cc: stable &lt;stable@vger.kernel.org&gt;
Acked-by: Jerome Marchand &lt;jmarchan@redhat.com&gt;
Signed-off-by: Rashika Kheria &lt;rashika.kheria@gmail.com&gt;
Acked-by: Minchan Kim &lt;minchan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch fixes the bug in reset_store caused by accessing NULL pointer.

The bdev gets its value from bdget_disk() which could fail when memory
pressure is severe and hence can return NULL because allocation of
inode in bdget could fail.

Hence, this patch introduces a check for bdev to prevent reference to a
NULL pointer in the later part of the code. It also removes unnecessary
check of bdev for fsync_bdev().

Cc: stable &lt;stable@vger.kernel.org&gt;
Acked-by: Jerome Marchand &lt;jmarchan@redhat.com&gt;
Signed-off-by: Rashika Kheria &lt;rashika.kheria@gmail.com&gt;
Acked-by: Minchan Kim &lt;minchan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Staging: zram: Fix variable dereferenced before check</title>
<updated>2013-10-30T16:32:10+00:00</updated>
<author>
<name>Rashika Kheria</name>
<email>rashika.kheria@gmail.com</email>
</author>
<published>2013-10-30T13:13:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=59d3fe540454dd8fc48d4eda44e200f9c98bef10'/>
<id>59d3fe540454dd8fc48d4eda44e200f9c98bef10</id>
<content type='text'>
This patch fixes the following Smatch warning in zram_drv.c-
drivers/staging/zram/zram_drv.c:899
destroy_device() warn: variable dereferenced before check 'zram-&gt;disk' (see line 896)

Acked-by: Minchan Kim &lt;minchan@kernel.org&gt;
Acked-by: Jerome Marchand &lt;jmarchan@redhat.com&gt;
Signed-off-by: Rashika Kheria &lt;rashika.kheria@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch fixes the following Smatch warning in zram_drv.c-
drivers/staging/zram/zram_drv.c:899
destroy_device() warn: variable dereferenced before check 'zram-&gt;disk' (see line 896)

Acked-by: Minchan Kim &lt;minchan@kernel.org&gt;
Acked-by: Jerome Marchand &lt;jmarchan@redhat.com&gt;
Signed-off-by: Rashika Kheria &lt;rashika.kheria@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "staging: zram: Add auto loading of module if user opens /dev/zram."</title>
<updated>2013-09-17T14:39:28+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2013-09-12T22:41:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=f0f65a95de2840db3fa61c953dca267e7b773168'/>
<id>f0f65a95de2840db3fa61c953dca267e7b773168</id>
<content type='text'>
This reverts commit c70bda992c12e593e411c02a52e4bd6985407539.

It's incorrect, Kay writes:
	Please just remove it. "devname" is meant to be used for
	single-instance devices with a static dev_t, never for things
	like zramX.

	It will not do anything useful here, it does nothing really
	without a statically assigned dev_t, and it should not be used
	for devices of this kind anyway.

Reported-by: Tom Gundersen &lt;teg@jklm.no&gt;
Reported-by: Kay Sievers &lt;kay@vrfy.org&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit c70bda992c12e593e411c02a52e4bd6985407539.

It's incorrect, Kay writes:
	Please just remove it. "devname" is meant to be used for
	single-instance devices with a static dev_t, never for things
	like zramX.

	It will not do anything useful here, it does nothing really
	without a statically assigned dev_t, and it should not be used
	for devices of this kind anyway.

Reported-by: Tom Gundersen &lt;teg@jklm.no&gt;
Reported-by: Kay Sievers &lt;kay@vrfy.org&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>zram: don't grab mutex in zram_slot_free_noity</title>
<updated>2013-08-12T22:25:00+00:00</updated>
<author>
<name>Minchan Kim</name>
<email>minchan@kernel.org</email>
</author>
<published>2013-08-12T06:13:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a0c516cbfc7452c8cbd564525fef66d9f20b46d1'/>
<id>a0c516cbfc7452c8cbd564525fef66d9f20b46d1</id>
<content type='text'>
[1] introduced down_write in zram_slot_free_notify to prevent race
between zram_slot_free_notify and zram_bvec_[read|write]. The race
could happen if somebody who has right permission to open swap device
is reading swap device while it is used by swap in parallel.

However, zram_slot_free_notify is called with holding spin_lock of
swap layer so we shouldn't avoid holing mutex. Otherwise, lockdep
warns it.

This patch adds new list to handle free slot and workqueue
so zram_slot_free_notify just registers slot index to be freed and
registers the request to workqueue. If workqueue is expired,
it holds mutex_lock so there is no problem any more.

If any I/O is issued, zram handles pending slot-free request
caused by zram_slot_free_notify right before handling issued
request because workqueue wouldn't be expired yet so zram I/O
request handling function can miss it.

Lastly, when zram is reset, flush_work could handle all of pending
free request so we shouldn't have memory leak.

NOTE: If zram_slot_free_notify's kmalloc with GFP_ATOMIC would be
failed, the slot will be freed when next write I/O write the slot.

[1] [57ab0485, zram: use zram-&gt;lock to protect zram_free_page()
    in swap free notify path]

* from v2
  * refactoring

* from v1
  * totally redesign

Cc: Nitin Gupta &lt;ngupta@vflare.org&gt;
Cc: Jiang Liu &lt;jiang.liu@huawei.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Minchan Kim &lt;minchan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[1] introduced down_write in zram_slot_free_notify to prevent race
between zram_slot_free_notify and zram_bvec_[read|write]. The race
could happen if somebody who has right permission to open swap device
is reading swap device while it is used by swap in parallel.

However, zram_slot_free_notify is called with holding spin_lock of
swap layer so we shouldn't avoid holing mutex. Otherwise, lockdep
warns it.

This patch adds new list to handle free slot and workqueue
so zram_slot_free_notify just registers slot index to be freed and
registers the request to workqueue. If workqueue is expired,
it holds mutex_lock so there is no problem any more.

If any I/O is issued, zram handles pending slot-free request
caused by zram_slot_free_notify right before handling issued
request because workqueue wouldn't be expired yet so zram I/O
request handling function can miss it.

Lastly, when zram is reset, flush_work could handle all of pending
free request so we shouldn't have memory leak.

NOTE: If zram_slot_free_notify's kmalloc with GFP_ATOMIC would be
failed, the slot will be freed when next write I/O write the slot.

[1] [57ab0485, zram: use zram-&gt;lock to protect zram_free_page()
    in swap free notify path]

* from v2
  * refactoring

* from v1
  * totally redesign

Cc: Nitin Gupta &lt;ngupta@vflare.org&gt;
Cc: Jiang Liu &lt;jiang.liu@huawei.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Minchan Kim &lt;minchan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>zram: fix invalid memory access</title>
<updated>2013-08-12T22:24:59+00:00</updated>
<author>
<name>Minchan Kim</name>
<email>minchan@kernel.org</email>
</author>
<published>2013-08-12T06:13:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2b86ab9cc29fcd435cde9378c3b9ffe8b5c76128'/>
<id>2b86ab9cc29fcd435cde9378c3b9ffe8b5c76128</id>
<content type='text'>
[1] tried to fix invalid memory access on zram-&gt;disk but it didn't
fix properly because get_disk failed during module exit path.

Actually, we don't need to reset zram-&gt;disk's capacity to zero
in module exit path so that this patch introduces new argument
"reset_capacity" on zram_reset_divice and it only reset it when
reset_store is called.

[1] 6030ea9b,  zram: avoid invalid memory access in zram_exit()

Cc: Nitin Gupta &lt;ngupta@vflare.org&gt;
Cc: Jiang Liu &lt;jiang.liu@huawei.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Minchan Kim &lt;minchan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[1] tried to fix invalid memory access on zram-&gt;disk but it didn't
fix properly because get_disk failed during module exit path.

Actually, we don't need to reset zram-&gt;disk's capacity to zero
in module exit path so that this patch introduces new argument
"reset_capacity" on zram_reset_divice and it only reset it when
reset_store is called.

[1] 6030ea9b,  zram: avoid invalid memory access in zram_exit()

Cc: Nitin Gupta &lt;ngupta@vflare.org&gt;
Cc: Jiang Liu &lt;jiang.liu@huawei.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Minchan Kim &lt;minchan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Staging: zram: zram_drv.c: Fixed Error of trailing whitespace</title>
<updated>2013-08-12T22:20:25+00:00</updated>
<author>
<name>Kumar Gaurav</name>
<email>kumargauravgupta3@gmail.com</email>
</author>
<published>2013-08-08T18:23:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a539c72a195c081d950475c2945cb82d80be9b66'/>
<id>a539c72a195c081d950475c2945cb82d80be9b66</id>
<content type='text'>
Fixed by removing trailing whitespace

Signed-off-by: Kumar Gaurav &lt;kumargauravgupta3@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixed by removing trailing whitespace

Signed-off-by: Kumar Gaurav &lt;kumargauravgupta3@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge 3.11-rc3 into staging-next</title>
<updated>2013-07-29T14:40:10+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2013-07-29T14:40:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=01731cf2eee38410b505c447026e46a591674835'/>
<id>01731cf2eee38410b505c447026e46a591674835</id>
<content type='text'>
We want these fixes here.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We want these fixes here.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>zram: prevent data loss in error cases of function zram_bvec_write()</title>
<updated>2013-07-26T23:30:05+00:00</updated>
<author>
<name>Sunghan Suh</name>
<email>sunghan.suh@samsung.com</email>
</author>
<published>2013-07-03T11:10:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=f40ac2ae1b506484dd9261a24bbf3e86b2206ff8'/>
<id>f40ac2ae1b506484dd9261a24bbf3e86b2206ff8</id>
<content type='text'>
In function zram_bvec_write(), previous data at the index is
already freed by function zram_free_page().
When failed to compress or zs_malloc, there is no way to restore old data.
Therefore, free previous data when it's about to update.

Also, no need to check whether table is not empty outside of
function zram_free_page(), because the function properly checks inside.

Signed-off-by: Sunghan Suh &lt;sunghan.suh@samsung.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In function zram_bvec_write(), previous data at the index is
already freed by function zram_free_page().
When failed to compress or zs_malloc, there is no way to restore old data.
Therefore, free previous data when it's about to update.

Also, no need to check whether table is not empty outside of
function zram_free_page(), because the function properly checks inside.

Signed-off-by: Sunghan Suh &lt;sunghan.suh@samsung.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>staging: zram: Add auto loading of module if user opens /dev/zram.</title>
<updated>2013-07-25T20:38:25+00:00</updated>
<author>
<name>Konrad Rzeszutek Wilk</name>
<email>konrad.wilk@oracle.com</email>
</author>
<published>2013-07-12T18:20:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c70bda992c12e593e411c02a52e4bd6985407539'/>
<id>c70bda992c12e593e411c02a52e4bd6985407539</id>
<content type='text'>
Greg spotted that said driver is not subscribing to the automagic
mechanism of auto-loading if a user tries to open /dev/zram.

This fixes it.

CC: Minchan Kim &lt;minchan@kernel.org&gt;
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Greg spotted that said driver is not subscribing to the automagic
mechanism of auto-loading if a user tries to open /dev/zram.

This fixes it.

CC: Minchan Kim &lt;minchan@kernel.org&gt;
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
