stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer
       [not found] <20131019110539.GA25167@gmail.com>
@ 2013-10-29 23:10 ` Rashika Kheria
  2013-10-29 23:12   ` [PATCH v7 2/3] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
                     ` (4 more replies)
  2013-10-30 13:06 ` [PATCH v8 " Rashika Kheria
                   ` (2 subsequent siblings)
  3 siblings, 5 replies; 22+ messages in thread
From: Rashika Kheria @ 2013-10-29 23:10 UTC (permalink / raw)
  To: opw-kernel, Minchan Kim, Greg Kroah-Hartman, Jiang Liu,
	Nitin Gupta, Jerome Marchand, linux-kernel
  Cc: stable

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@vger.kernel.org
Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
---

This patch fixes the following issues of the previous revision-
Better Description

 drivers/staging/zram/zram_drv.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 2c4ed52..d640a8f 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -648,6 +648,9 @@ static ssize_t reset_store(struct device *dev,
 	zram = dev_to_zram(dev);
 	bdev = bdget_disk(zram->disk, 0);
 
+	if (!bdev)
+		return -EBUSY;
+
 	/* Do not reset an active device! */
 	if (bdev->bd_holders)
 		return -EBUSY;
@@ -660,8 +663,7 @@ static ssize_t reset_store(struct device *dev,
 		return -EINVAL;
 
 	/* Make sure all pending I/O is finished */
-	if (bdev)
-		fsync_bdev(bdev);
+	fsync_bdev(bdev);
 
 	zram_reset_device(zram, true);
 	return len;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v7 2/3] Staging: zram: Fix decrement of variable by calling bdput()
  2013-10-29 23:10 ` [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer Rashika Kheria
@ 2013-10-29 23:12   ` Rashika Kheria
  2013-10-30  2:33     ` Minchan Kim
  2013-10-29 23:15   ` [PATCH v7 3/3] Staging: zram: Fix variable dereferenced before check Rashika Kheria
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 22+ messages in thread
From: Rashika Kheria @ 2013-10-29 23:12 UTC (permalink / raw)
  To: opw-kernel, Minchan Kim, Greg Kroah-Hartman, Jiang Liu,
	Nitin Gupta, Jerome Marchand, linux-kernel
  Cc: stable

As suggested by 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 therefor incremented but never decremented."

Hence, this patch introduces a call to bdput() to decrement the variable after usage.

Cc: stable@vger.kernel.org
Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
---

This revision fixes the following issues of the previous revision-
Handle more error cases

 drivers/staging/zram/zram_drv.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index d640a8f..592e760 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -664,6 +664,9 @@ static ssize_t reset_store(struct device *dev,
 
 	/* Make sure all pending I/O is finished */
 	fsync_bdev(bdev);
+	bdput(bdev);
+	bdput(bdev->bd_holders);
+	bdput(do_reset);
 
 	zram_reset_device(zram, true);
 	return len;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v7 3/3] Staging: zram: Fix variable dereferenced before check
  2013-10-29 23:10 ` [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer Rashika Kheria
  2013-10-29 23:12   ` [PATCH v7 2/3] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
@ 2013-10-29 23:15   ` Rashika Kheria
  2013-10-30  2:35     ` Minchan Kim
  2013-10-30 10:44     ` Jerome Marchand
  2013-10-30  2:24   ` [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer Minchan Kim
                     ` (2 subsequent siblings)
  4 siblings, 2 replies; 22+ messages in thread
From: Rashika Kheria @ 2013-10-29 23:15 UTC (permalink / raw)
  To: opw-kernel, Minchan Kim, Greg Kroah-Hartman, Jiang Liu,
	Nitin Gupta, Jerome Marchand, linux-kernel
  Cc: stable

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->disk' (see line 896)

Cc: stable@vger.kernel.org
Acked-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
---
 drivers/staging/zram/zram_drv.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 592e760..bf28d56 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -901,13 +901,10 @@ static void destroy_device(struct zram *zram)
 	sysfs_remove_group(&disk_to_dev(zram->disk)->kobj,
 			&zram_disk_attr_group);
 
-	if (zram->disk) {
-		del_gendisk(zram->disk);
-		put_disk(zram->disk);
-	}
+	del_gendisk(zram->disk);
+	put_disk(zram->disk);
 
-	if (zram->queue)
-		blk_cleanup_queue(zram->queue);
+	blk_cleanup_queue(zram->queue);
 }
 
 static int __init zram_init(void)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer
  2013-10-29 23:10 ` [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer Rashika Kheria
  2013-10-29 23:12   ` [PATCH v7 2/3] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
  2013-10-29 23:15   ` [PATCH v7 3/3] Staging: zram: Fix variable dereferenced before check Rashika Kheria
@ 2013-10-30  2:24   ` Minchan Kim
  2013-10-30  2:36   ` Minchan Kim
  2013-10-30 10:42   ` Jerome Marchand
  4 siblings, 0 replies; 22+ messages in thread
From: Minchan Kim @ 2013-10-30  2:24 UTC (permalink / raw)
  To: Rashika Kheria
  Cc: opw-kernel, Greg Kroah-Hartman, Jiang Liu, Nitin Gupta,
	Jerome Marchand, linux-kernel, stable

On Wed, Oct 30, 2013 at 04:40:54AM +0530, Rashika Kheria wrote:
> 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@vger.kernel.org
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>

-- 
Kind regards,
Minchan Kim

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v7 2/3] Staging: zram: Fix decrement of variable by calling bdput()
  2013-10-29 23:12   ` [PATCH v7 2/3] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
@ 2013-10-30  2:33     ` Minchan Kim
  0 siblings, 0 replies; 22+ messages in thread
From: Minchan Kim @ 2013-10-30  2:33 UTC (permalink / raw)
  To: Rashika Kheria
  Cc: opw-kernel, Greg Kroah-Hartman, Jiang Liu, Nitin Gupta,
	Jerome Marchand, linux-kernel, stable

On Wed, Oct 30, 2013 at 04:42:56AM +0530, Rashika Kheria wrote:
> As suggested by 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 therefor incremented but never decremented."
> 
> Hence, this patch introduces a call to bdput() to decrement the variable after usage.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
> ---
> 
> This revision fixes the following issues of the previous revision-
> Handle more error cases
> 
>  drivers/staging/zram/zram_drv.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
> index d640a8f..592e760 100644
> --- a/drivers/staging/zram/zram_drv.c
> +++ b/drivers/staging/zram/zram_drv.c
> @@ -664,6 +664,9 @@ static ssize_t reset_store(struct device *dev,
>  
>  	/* Make sure all pending I/O is finished */
>  	fsync_bdev(bdev);
> +	bdput(bdev);
> +	bdput(bdev->bd_holders);
> +	bdput(do_reset);

I meant it.

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index e77fb6e..32f9a44 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -621,22 +621,30 @@ static ssize_t reset_store(struct device *dev,
 	bdev = bdget_disk(zram->disk, 0);
 
 	/* Do not reset an active device! */
-	if (bdev->bd_holders)
-		return -EBUSY;
+	if (bdev->bd_holders) {
+		ret = -EBUSY;
+		goto out;
+	}
 
 	ret = kstrtou16(buf, 10, &do_reset);
 	if (ret)
-		return ret;
+		goto out;
 
-	if (!do_reset)
-		return -EINVAL;
+	if (!do_reset) {
+		ret = -EINVAL;
+		goto out;
+	}
 
 	/* Make sure all pending I/O is finished */
-	if (bdev)
-		fsync_bdev(bdev);
+	fsync_bdev(bdev);
+	bdput(bdev);
 
 	zram_reset_device(zram);
 	return len;
+
+out:
+	bdput(bdev);
+	return ret;
 }
 
 static void __zram_make_request(struct zram *zram, struct bio *bio, int rw)

-- 
Kind regards,
Minchan Kim

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v7 3/3] Staging: zram: Fix variable dereferenced before check
  2013-10-29 23:15   ` [PATCH v7 3/3] Staging: zram: Fix variable dereferenced before check Rashika Kheria
@ 2013-10-30  2:35     ` Minchan Kim
  2013-10-30 10:44     ` Jerome Marchand
  1 sibling, 0 replies; 22+ messages in thread
From: Minchan Kim @ 2013-10-30  2:35 UTC (permalink / raw)
  To: Rashika Kheria
  Cc: opw-kernel, Greg Kroah-Hartman, Jiang Liu, Nitin Gupta,
	Jerome Marchand, linux-kernel, stable

On Wed, Oct 30, 2013 at 04:45:24AM +0530, Rashika Kheria wrote:
> 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->disk' (see line 896)
> 
> Cc: stable@vger.kernel.org

It shouldn't be a stable stuff because it's just warning of Smatch
but there is no bug in real practice.

> Acked-by: Minchan Kim <minchan@kernel.org>
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
> ---
>  drivers/staging/zram/zram_drv.c |    9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
> index 592e760..bf28d56 100644
> --- a/drivers/staging/zram/zram_drv.c
> +++ b/drivers/staging/zram/zram_drv.c
> @@ -901,13 +901,10 @@ static void destroy_device(struct zram *zram)
>  	sysfs_remove_group(&disk_to_dev(zram->disk)->kobj,
>  			&zram_disk_attr_group);
>  
> -	if (zram->disk) {
> -		del_gendisk(zram->disk);
> -		put_disk(zram->disk);
> -	}
> +	del_gendisk(zram->disk);
> +	put_disk(zram->disk);
>  
> -	if (zram->queue)
> -		blk_cleanup_queue(zram->queue);
> +	blk_cleanup_queue(zram->queue);
>  }
>  
>  static int __init zram_init(void)
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Kind regards,
Minchan Kim

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer
  2013-10-29 23:10 ` [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer Rashika Kheria
                     ` (2 preceding siblings ...)
  2013-10-30  2:24   ` [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer Minchan Kim
@ 2013-10-30  2:36   ` Minchan Kim
  2013-10-30 10:42   ` Jerome Marchand
  4 siblings, 0 replies; 22+ messages in thread
From: Minchan Kim @ 2013-10-30  2:36 UTC (permalink / raw)
  To: Rashika Kheria
  Cc: opw-kernel, Greg Kroah-Hartman, Jiang Liu, Nitin Gupta,
	Jerome Marchand, linux-kernel, stable

On Wed, Oct 30, 2013 at 04:40:54AM +0530, Rashika Kheria wrote:
> 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@vger.kernel.org
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
> ---
> 
> This patch fixes the following issues of the previous revision-
> Better Description
> 
>  drivers/staging/zram/zram_drv.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
> index 2c4ed52..d640a8f 100644
> --- a/drivers/staging/zram/zram_drv.c
> +++ b/drivers/staging/zram/zram_drv.c
> @@ -648,6 +648,9 @@ static ssize_t reset_store(struct device *dev,
>  	zram = dev_to_zram(dev);
>  	bdev = bdget_disk(zram->disk, 0);
>  
> +	if (!bdev)
> +		return -EBUSY;
> +

Oops, Sorry.
I don't think EBUSY is right. How about ENOMEM?

-- 
Kind regards,
Minchan Kim

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer
  2013-10-29 23:10 ` [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer Rashika Kheria
                     ` (3 preceding siblings ...)
  2013-10-30  2:36   ` Minchan Kim
@ 2013-10-30 10:42   ` Jerome Marchand
  4 siblings, 0 replies; 22+ messages in thread
From: Jerome Marchand @ 2013-10-30 10:42 UTC (permalink / raw)
  To: Rashika Kheria
  Cc: opw-kernel, Minchan Kim, Greg Kroah-Hartman, Jiang Liu,
	Nitin Gupta, Jerome Marchand, linux-kernel, stable

On 10/30/2013 12:10 AM, Rashika Kheria wrote:
> 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@vger.kernel.org
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Acked-by: Jerome Marchand <jmarchan@redhat.com>

> ---
> 
> This patch fixes the following issues of the previous revision-
> Better Description
> 
>  drivers/staging/zram/zram_drv.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
> index 2c4ed52..d640a8f 100644
> --- a/drivers/staging/zram/zram_drv.c
> +++ b/drivers/staging/zram/zram_drv.c
> @@ -648,6 +648,9 @@ static ssize_t reset_store(struct device *dev,
>  	zram = dev_to_zram(dev);
>  	bdev = bdget_disk(zram->disk, 0);
>  
> +	if (!bdev)
> +		return -EBUSY;
> +
>  	/* Do not reset an active device! */
>  	if (bdev->bd_holders)
>  		return -EBUSY;
> @@ -660,8 +663,7 @@ static ssize_t reset_store(struct device *dev,
>  		return -EINVAL;
>  
>  	/* Make sure all pending I/O is finished */
> -	if (bdev)
> -		fsync_bdev(bdev);
> +	fsync_bdev(bdev);
>  
>  	zram_reset_device(zram, true);
>  	return len;
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v7 3/3] Staging: zram: Fix variable dereferenced before check
  2013-10-29 23:15   ` [PATCH v7 3/3] Staging: zram: Fix variable dereferenced before check Rashika Kheria
  2013-10-30  2:35     ` Minchan Kim
@ 2013-10-30 10:44     ` Jerome Marchand
  1 sibling, 0 replies; 22+ messages in thread
From: Jerome Marchand @ 2013-10-30 10:44 UTC (permalink / raw)
  To: Rashika Kheria
  Cc: opw-kernel, Minchan Kim, Greg Kroah-Hartman, Jiang Liu,
	Nitin Gupta, Jerome Marchand, linux-kernel, stable

On 10/30/2013 12:15 AM, Rashika Kheria wrote:
> 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->disk' (see line 896)
> 
> Cc: stable@vger.kernel.org
> Acked-by: Minchan Kim <minchan@kernel.org>
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Acked-by: Jerome Marchand <jmarchan@redhat.com>

> ---
>  drivers/staging/zram/zram_drv.c |    9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
> index 592e760..bf28d56 100644
> --- a/drivers/staging/zram/zram_drv.c
> +++ b/drivers/staging/zram/zram_drv.c
> @@ -901,13 +901,10 @@ static void destroy_device(struct zram *zram)
>  	sysfs_remove_group(&disk_to_dev(zram->disk)->kobj,
>  			&zram_disk_attr_group);
>  
> -	if (zram->disk) {
> -		del_gendisk(zram->disk);
> -		put_disk(zram->disk);
> -	}
> +	del_gendisk(zram->disk);
> +	put_disk(zram->disk);
>  
> -	if (zram->queue)
> -		blk_cleanup_queue(zram->queue);
> +	blk_cleanup_queue(zram->queue);
>  }
>  
>  static int __init zram_init(void)
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v8 1/3] Staging: zram: Fix access of NULL pointer
       [not found] <20131019110539.GA25167@gmail.com>
  2013-10-29 23:10 ` [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer Rashika Kheria
@ 2013-10-30 13:06 ` Rashika Kheria
  2013-10-30 13:10   ` [PATCH v8 2/3] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
  2013-10-31 11:56 ` [PATCH v9 1/2] Staging: zram: Fix access of NULL pointer Rashika Kheria
  2013-11-01 14:06 ` [PATCH v10] Staging: zram: Fix memory leak by refcount mismatch Rashika Kheria
  3 siblings, 1 reply; 22+ messages in thread
From: Rashika Kheria @ 2013-10-30 13:06 UTC (permalink / raw)
  To: opw-kernel, Minchan Kim, Greg Kroah-Hartman, Jiang Liu,
	Nitin Gupta, Jerome Marchand, linux-kernel
  Cc: stable

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@vger.kernel.org
Acked-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
---

The previous revision fixes the following issues of the previous revision-
Change return error code

 drivers/staging/zram/zram_drv.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 2c4ed52..012ba15 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -648,6 +648,9 @@ static ssize_t reset_store(struct device *dev,
 	zram = dev_to_zram(dev);
 	bdev = bdget_disk(zram->disk, 0);
 
+	if (!bdev)
+		return -ENOMEM;
+
 	/* Do not reset an active device! */
 	if (bdev->bd_holders)
 		return -EBUSY;
@@ -660,8 +663,7 @@ static ssize_t reset_store(struct device *dev,
 		return -EINVAL;
 
 	/* Make sure all pending I/O is finished */
-	if (bdev)
-		fsync_bdev(bdev);
+	fsync_bdev(bdev);
 
 	zram_reset_device(zram, true);
 	return len;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v8 2/3] Staging: zram: Fix decrement of variable by calling bdput()
  2013-10-30 13:06 ` [PATCH v8 " Rashika Kheria
@ 2013-10-30 13:10   ` Rashika Kheria
  2013-10-31  9:42     ` Weijie Yang
  0 siblings, 1 reply; 22+ messages in thread
From: Rashika Kheria @ 2013-10-30 13:10 UTC (permalink / raw)
  To: opw-kernel, Minchan Kim, Greg Kroah-Hartman, Jiang Liu,
	Nitin Gupta, Jerome Marchand, linux-kernel
  Cc: stable

As suggested by 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.

Cc: stable@vger.kernel.org
Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
---

This revision fixes the following issues of the previous revision-
Proper error handling

 drivers/staging/zram/zram_drv.c |   25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 012ba15..0bc2835 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -648,25 +648,36 @@ static ssize_t reset_store(struct device *dev,
 	zram = dev_to_zram(dev);
 	bdev = bdget_disk(zram->disk, 0);
 
-	if (!bdev)
-		return -ENOMEM;
+	if (!bdev) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
 	/* Do not reset an active device! */
-	if (bdev->bd_holders)
-		return -EBUSY;
+	if (bdev->bd_holders) {
+		ret = -EBUSY;
+		goto out;
+	}
 
 	ret = kstrtou16(buf, 10, &do_reset);
 	if (ret)
-		return ret;
+		goto out;
 
-	if (!do_reset)
-		return -EINVAL;
+	if (!do_reset) {
+		ret = -EINVAL;
+		goto out;
+	}
 
 	/* Make sure all pending I/O is finished */
 	fsync_bdev(bdev);
+	bdput(bdev);
 
 	zram_reset_device(zram, true);
 	return len;
+
+out:	
+	bdput(bdev);
+	return ret;
 }
 
 static void __zram_make_request(struct zram *zram, struct bio *bio, int rw)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v8 2/3] Staging: zram: Fix decrement of variable by calling bdput()
  2013-10-30 13:10   ` [PATCH v8 2/3] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
@ 2013-10-31  9:42     ` Weijie Yang
  0 siblings, 0 replies; 22+ messages in thread
From: Weijie Yang @ 2013-10-31  9:42 UTC (permalink / raw)
  To: Rashika Kheria
  Cc: opw-kernel, Minchan Kim, Greg Kroah-Hartman, Jiang Liu,
	Nitin Gupta, Jerome Marchand, linux-kernel, stable

Hello, Rashika

On Wed, Oct 30, 2013 at 9:10 PM, Rashika Kheria
<rashika.kheria@gmail.com> wrote:
> As suggested by 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.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
> ---
>
> This revision fixes the following issues of the previous revision-
> Proper error handling
>
>  drivers/staging/zram/zram_drv.c |   25 ++++++++++++++++++-------
>  1 file changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
> index 012ba15..0bc2835 100644
> --- a/drivers/staging/zram/zram_drv.c
> +++ b/drivers/staging/zram/zram_drv.c
> @@ -648,25 +648,36 @@ static ssize_t reset_store(struct device *dev,
>         zram = dev_to_zram(dev);
>         bdev = bdget_disk(zram->disk, 0);
>
> -       if (!bdev)
> -               return -ENOMEM;
> +       if (!bdev) {
> +               ret = -ENOMEM;
> +               goto out;
> +       }

If bdev is NULL, just return -ENOMEM; DO NOT goto out;
or you will get a NULL point reference in bdput(bdev);

>         /* Do not reset an active device! */
> -       if (bdev->bd_holders)
> -               return -EBUSY;
> +       if (bdev->bd_holders) {
> +               ret = -EBUSY;
> +               goto out;
> +       }
>
>         ret = kstrtou16(buf, 10, &do_reset);
>         if (ret)
> -               return ret;
> +               goto out;
>
> -       if (!do_reset)
> -               return -EINVAL;
> +       if (!do_reset) {
> +               ret = -EINVAL;
> +               goto out;
> +       }
>
>         /* Make sure all pending I/O is finished */
>         fsync_bdev(bdev);
> +       bdput(bdev);
>
>         zram_reset_device(zram, true);
>         return len;
> +
> +out:
> +       bdput(bdev);
> +       return ret;
>  }
>
>  static void __zram_make_request(struct zram *zram, struct bio *bio, int rw)
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v9 1/2] Staging: zram: Fix access of NULL pointer
       [not found] <20131019110539.GA25167@gmail.com>
  2013-10-29 23:10 ` [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer Rashika Kheria
  2013-10-30 13:06 ` [PATCH v8 " Rashika Kheria
@ 2013-10-31 11:56 ` Rashika Kheria
  2013-10-31 11:58   ` [PATCH v9 2/2] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
  2013-11-01 14:06 ` [PATCH v10] Staging: zram: Fix memory leak by refcount mismatch Rashika Kheria
  3 siblings, 1 reply; 22+ messages in thread
From: Rashika Kheria @ 2013-10-31 11:56 UTC (permalink / raw)
  To: opw-kernel, Minchan Kim, Greg Kroah-Hartman, Jiang Liu,
	Nitin Gupta, Jerome Marchand, linux-kernel
  Cc: stable

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@vger.kernel.org
Acked-by: Jerome Marchand <jmarchan@redhat.com> 
Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
---
 drivers/staging/zram/zram_drv.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 2c4ed52..012ba15 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -648,6 +648,9 @@ static ssize_t reset_store(struct device *dev,
 	zram = dev_to_zram(dev);
 	bdev = bdget_disk(zram->disk, 0);
 
+	if (!bdev)
+		return -ENOMEM;
+
 	/* Do not reset an active device! */
 	if (bdev->bd_holders)
 		return -EBUSY;
@@ -660,8 +663,7 @@ static ssize_t reset_store(struct device *dev,
 		return -EINVAL;
 
 	/* Make sure all pending I/O is finished */
-	if (bdev)
-		fsync_bdev(bdev);
+	fsync_bdev(bdev);
 
 	zram_reset_device(zram, true);
 	return len;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v9 2/2] Staging: zram: Fix decrement of variable by calling bdput()
  2013-10-31 11:56 ` [PATCH v9 1/2] Staging: zram: Fix access of NULL pointer Rashika Kheria
@ 2013-10-31 11:58   ` Rashika Kheria
  2013-11-01  2:00     ` Minchan Kim
  2013-11-01  8:54     ` Jerome Marchand
  0 siblings, 2 replies; 22+ messages in thread
From: Rashika Kheria @ 2013-10-31 11:58 UTC (permalink / raw)
  To: opw-kernel, Minchan Kim, Greg Kroah-Hartman, Jiang Liu,
	Nitin Gupta, Jerome Marchand, linux-kernel
  Cc: stable

As suggested by 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.

Cc: stable@vger.kernel.org 
Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
---

This revision fixes the following issues of the previous revision-
Proper error handling

 drivers/staging/zram/zram_drv.c |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 012ba15..a1f8b1f 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -652,21 +652,30 @@ static ssize_t reset_store(struct device *dev,
 		return -ENOMEM;
 
 	/* Do not reset an active device! */
-	if (bdev->bd_holders)
-		return -EBUSY;
+	if (bdev->bd_holders) {
+		ret = -EBUSY;
+		goto out;
+	}
 
 	ret = kstrtou16(buf, 10, &do_reset);
 	if (ret)
-		return ret;
+		goto out;
 
-	if (!do_reset)
-		return -EINVAL;
+	if (!do_reset) {
+		ret = -EINVAL;
+		goto out;
+	}
 
 	/* Make sure all pending I/O is finished */
 	fsync_bdev(bdev);
+	bdput(bdev);
 
 	zram_reset_device(zram, true);
 	return len;
+
+out:	
+	bdput(bdev);
+	return ret;
 }
 
 static void __zram_make_request(struct zram *zram, struct bio *bio, int rw)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v9 2/2] Staging: zram: Fix decrement of variable by calling bdput()
  2013-10-31 11:58   ` [PATCH v9 2/2] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
@ 2013-11-01  2:00     ` Minchan Kim
  2013-11-01  8:54     ` Jerome Marchand
  1 sibling, 0 replies; 22+ messages in thread
From: Minchan Kim @ 2013-11-01  2:00 UTC (permalink / raw)
  To: Rashika Kheria
  Cc: opw-kernel, Greg Kroah-Hartman, Jiang Liu, Nitin Gupta,
	Jerome Marchand, linux-kernel, stable

I hope subject should be "Fix memory leak by refcount mismatch"

On Thu, Oct 31, 2013 at 05:28:18PM +0530, Rashika Kheria wrote:
> As suggested by 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.
> 
> Cc: stable@vger.kernel.org 
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>

Other than that,
Acked-by: Minchan Kim <minchan@kernel.org>


Rashika, Thanks!

-- 
Kind regards,
Minchan Kim

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v9 2/2] Staging: zram: Fix decrement of variable by calling bdput()
  2013-10-31 11:58   ` [PATCH v9 2/2] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
  2013-11-01  2:00     ` Minchan Kim
@ 2013-11-01  8:54     ` Jerome Marchand
  2013-11-01 14:13       ` Rashika Kheria
  1 sibling, 1 reply; 22+ messages in thread
From: Jerome Marchand @ 2013-11-01  8:54 UTC (permalink / raw)
  To: Rashika Kheria
  Cc: opw-kernel, Minchan Kim, Greg Kroah-Hartman, Jiang Liu,
	Nitin Gupta, Jerome Marchand, linux-kernel, stable

On 10/31/2013 12:58 PM, Rashika Kheria wrote:
> As suggested by Jerome Marchand "The code in reset_store get the block device
The credit should actually go to Minchan. He found the bug. I merely
explained it.

> (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.
> 
> Cc: stable@vger.kernel.org 
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>

This version finally looks good. Thanks for your effort.

Acked-by: Jerome Marchand <jmarchan@redhat.com>

> ---
> 
> This revision fixes the following issues of the previous revision-
> Proper error handling
> 
>  drivers/staging/zram/zram_drv.c |   19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
> index 012ba15..a1f8b1f 100644
> --- a/drivers/staging/zram/zram_drv.c
> +++ b/drivers/staging/zram/zram_drv.c
> @@ -652,21 +652,30 @@ static ssize_t reset_store(struct device *dev,
>  		return -ENOMEM;
>  
>  	/* Do not reset an active device! */
> -	if (bdev->bd_holders)
> -		return -EBUSY;
> +	if (bdev->bd_holders) {
> +		ret = -EBUSY;
> +		goto out;
> +	}
>  
>  	ret = kstrtou16(buf, 10, &do_reset);
>  	if (ret)
> -		return ret;
> +		goto out;
>  
> -	if (!do_reset)
> -		return -EINVAL;
> +	if (!do_reset) {
> +		ret = -EINVAL;
> +		goto out;
> +	}
>  
>  	/* Make sure all pending I/O is finished */
>  	fsync_bdev(bdev);
> +	bdput(bdev);
>  
>  	zram_reset_device(zram, true);
>  	return len;
> +
> +out:	
> +	bdput(bdev);
> +	return ret;
>  }
>  
>  static void __zram_make_request(struct zram *zram, struct bio *bio, int rw)
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v10] Staging: zram: Fix memory leak by refcount mismatch
       [not found] <20131019110539.GA25167@gmail.com>
                   ` (2 preceding siblings ...)
  2013-10-31 11:56 ` [PATCH v9 1/2] Staging: zram: Fix access of NULL pointer Rashika Kheria
@ 2013-11-01 14:06 ` Rashika Kheria
  2013-11-10 15:45   ` Greg Kroah-Hartman
  3 siblings, 1 reply; 22+ messages in thread
From: Rashika Kheria @ 2013-11-01 14:06 UTC (permalink / raw)
  To: opw-kernel, Minchan Kim, Greg Kroah-Hartman, Jiang Liu,
	Nitin Gupta, Jerome Marchand, linux-kernel
  Cc: stable

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 <minchan@kernel.org>
Acked-by: Jerome Marchand <jmarchan@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
---

This revision fixes the following issue of the previous revision-
Incorrect Subject Line

 drivers/staging/zram/zram_drv.c |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 012ba15..a1f8b1f 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -652,21 +652,30 @@ static ssize_t reset_store(struct device *dev,
 		return -ENOMEM;
 
 	/* Do not reset an active device! */
-	if (bdev->bd_holders)
-		return -EBUSY;
+	if (bdev->bd_holders) {
+		ret = -EBUSY;
+		goto out;
+	}
 
 	ret = kstrtou16(buf, 10, &do_reset);
 	if (ret)
-		return ret;
+		goto out;
 
-	if (!do_reset)
-		return -EINVAL;
+	if (!do_reset) {
+		ret = -EINVAL;
+		goto out;
+	}
 
 	/* Make sure all pending I/O is finished */
 	fsync_bdev(bdev);
+	bdput(bdev);
 
 	zram_reset_device(zram, true);
 	return len;
+
+out:	
+	bdput(bdev);
+	return ret;
 }
 
 static void __zram_make_request(struct zram *zram, struct bio *bio, int rw)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v9 2/2] Staging: zram: Fix decrement of variable by calling bdput()
  2013-11-01  8:54     ` Jerome Marchand
@ 2013-11-01 14:13       ` Rashika Kheria
  0 siblings, 0 replies; 22+ messages in thread
From: Rashika Kheria @ 2013-11-01 14:13 UTC (permalink / raw)
  To: Jerome Marchand
  Cc: opw-kernel, Minchan Kim, Greg Kroah-Hartman, Jiang Liu,
	Nitin Gupta, Jerome Marchand, Linux-Kernel, stable

On Fri, Nov 1, 2013 at 2:24 PM, Jerome Marchand <jmarchan@redhat.com> wrote:
>
> On 10/31/2013 12:58 PM, Rashika Kheria wrote:
> > As suggested by Jerome Marchand "The code in reset_store get the block device
> The credit should actually go to Minchan. He found the bug. I merely
> explained it.
>
> > (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.
> >
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
>
> This version finally looks good. Thanks for your effort.
>
> Acked-by: Jerome Marchand <jmarchan@redhat.com>
>
>

Hi,

Thanks Minchan and Jerome for all you support and patience.
Your guidance helped me learn more about zram and kernel coding style
in general. :)

Thanks,
-- 
Rashika Kheria
B.Tech CSE
IIIT Hyderabad

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v10] Staging: zram: Fix memory leak by refcount mismatch
  2013-11-01 14:06 ` [PATCH v10] Staging: zram: Fix memory leak by refcount mismatch Rashika Kheria
@ 2013-11-10 15:45   ` Greg Kroah-Hartman
  2013-11-10 15:56     ` [OPW kernel] " Rashika Kheria
  0 siblings, 1 reply; 22+ messages in thread
From: Greg Kroah-Hartman @ 2013-11-10 15:45 UTC (permalink / raw)
  To: Rashika Kheria
  Cc: opw-kernel, Minchan Kim, Jiang Liu, Nitin Gupta, Jerome Marchand,
	linux-kernel, stable

On Fri, Nov 01, 2013 at 07:36:09PM +0530, Rashika Kheria wrote:
> 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 <minchan@kernel.org>
> Acked-by: Jerome Marchand <jmarchan@redhat.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
> ---
> 
> This revision fixes the following issue of the previous revision-
> Incorrect Subject Line

I'm a bit confused now, I see three different zram patches from you,
with different subjects, are they all now just in one patch, this one?

Can you just send me the outstanding zram patches that you have gotten
acks from that you want applied, as I'm lost here.

thanks,

greg "easily confused" k-h

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [OPW kernel] Re: [PATCH v10] Staging: zram: Fix memory leak by refcount mismatch
  2013-11-10 15:45   ` Greg Kroah-Hartman
@ 2013-11-10 15:56     ` Rashika Kheria
  2013-11-10 16:10       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 22+ messages in thread
From: Rashika Kheria @ 2013-11-10 15:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: opw-kernel, Minchan Kim, Jiang Liu, Nitin Gupta, Jerome Marchand,
	Linux-Kernel, stable

On Sun, Nov 10, 2013 at 9:15 PM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Fri, Nov 01, 2013 at 07:36:09PM +0530, Rashika Kheria wrote:
>> 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 <minchan@kernel.org>
>> Acked-by: Jerome Marchand <jmarchan@redhat.com>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
>> ---
>>
>> This revision fixes the following issue of the previous revision-
>> Incorrect Subject Line
>
> I'm a bit confused now, I see three different zram patches from you,
> with different subjects, are they all now just in one patch, this one?
>
> Can you just send me the outstanding zram patches that you have gotten
> acks from that you want applied, as I'm lost here.
>
> thanks,
>
> greg "easily confused" k-h
>

Hi Greg,

You have already applied the rest two patches for this driver. This is
the only patch which is left.

But I think you might have problem applying this because there have
been changes in previous patches later i.e you applied v8 of this
series, while, maintainers later suggested to change more and hence v9
was also introduced.

Therefore, v9's patch 1 and v10 patch is correct to be applied in the tree.

Thanks,
-- 
Rashika Kheria
B.Tech CSE
IIIT Hyderabad

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [OPW kernel] Re: [PATCH v10] Staging: zram: Fix memory leak by refcount mismatch
  2013-11-10 15:56     ` [OPW kernel] " Rashika Kheria
@ 2013-11-10 16:10       ` Greg Kroah-Hartman
  2013-11-10 16:14         ` Rashika Kheria
  0 siblings, 1 reply; 22+ messages in thread
From: Greg Kroah-Hartman @ 2013-11-10 16:10 UTC (permalink / raw)
  To: Rashika Kheria
  Cc: opw-kernel, Minchan Kim, Jiang Liu, Nitin Gupta, Jerome Marchand,
	Linux-Kernel, stable

On Sun, Nov 10, 2013 at 09:26:15PM +0530, Rashika Kheria wrote:
> On Sun, Nov 10, 2013 at 9:15 PM, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > On Fri, Nov 01, 2013 at 07:36:09PM +0530, Rashika Kheria wrote:
> >> 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 <minchan@kernel.org>
> >> Acked-by: Jerome Marchand <jmarchan@redhat.com>
> >> Cc: stable@vger.kernel.org
> >> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
> >> ---
> >>
> >> This revision fixes the following issue of the previous revision-
> >> Incorrect Subject Line
> >
> > I'm a bit confused now, I see three different zram patches from you,
> > with different subjects, are they all now just in one patch, this one?
> >
> > Can you just send me the outstanding zram patches that you have gotten
> > acks from that you want applied, as I'm lost here.
> >
> > thanks,
> >
> > greg "easily confused" k-h
> >
> 
> Hi Greg,
> 
> You have already applied the rest two patches for this driver. This is
> the only patch which is left.
> 
> But I think you might have problem applying this because there have
> been changes in previous patches later i.e you applied v8 of this
> series, while, maintainers later suggested to change more and hence v9
> was also introduced.
> 
> Therefore, v9's patch 1 and v10 patch is correct to be applied in the tree.

Hm, can you please resend them, as I no longer have them in my queue.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [OPW kernel] Re: [PATCH v10] Staging: zram: Fix memory leak by refcount mismatch
  2013-11-10 16:10       ` Greg Kroah-Hartman
@ 2013-11-10 16:14         ` Rashika Kheria
  0 siblings, 0 replies; 22+ messages in thread
From: Rashika Kheria @ 2013-11-10 16:14 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: opw-kernel, Minchan Kim, Jiang Liu, Nitin Gupta, Jerome Marchand,
	Linux-Kernel, stable

On Sun, Nov 10, 2013 at 9:40 PM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Sun, Nov 10, 2013 at 09:26:15PM +0530, Rashika Kheria wrote:
>> On Sun, Nov 10, 2013 at 9:15 PM, Greg Kroah-Hartman
>> <gregkh@linuxfoundation.org> wrote:
>> > On Fri, Nov 01, 2013 at 07:36:09PM +0530, Rashika Kheria wrote:
>> >> 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 <minchan@kernel.org>
>> >> Acked-by: Jerome Marchand <jmarchan@redhat.com>
>> >> Cc: stable@vger.kernel.org
>> >> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
>> >> ---
>> >>
>> >> This revision fixes the following issue of the previous revision-
>> >> Incorrect Subject Line
>> >
>> > I'm a bit confused now, I see three different zram patches from you,
>> > with different subjects, are they all now just in one patch, this one?
>> >
>> > Can you just send me the outstanding zram patches that you have gotten
>> > acks from that you want applied, as I'm lost here.
>> >
>> > thanks,
>> >
>> > greg "easily confused" k-h
>> >
>>
>> Hi Greg,
>>
>> You have already applied the rest two patches for this driver. This is
>> the only patch which is left.
>>
>> But I think you might have problem applying this because there have
>> been changes in previous patches later i.e you applied v8 of this
>> series, while, maintainers later suggested to change more and hence v9
>> was also introduced.
>>
>> Therefore, v9's patch 1 and v10 patch is correct to be applied in the tree.
>
> Hm, can you please resend them, as I no longer have them in my queue.
>
> thanks,
>
> greg k-h
>

Resent.

Thanks,
-- 
Rashika Kheria
B.Tech CSE
IIIT Hyderabad

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2013-11-10 16:14 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20131019110539.GA25167@gmail.com>
2013-10-29 23:10 ` [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer Rashika Kheria
2013-10-29 23:12   ` [PATCH v7 2/3] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
2013-10-30  2:33     ` Minchan Kim
2013-10-29 23:15   ` [PATCH v7 3/3] Staging: zram: Fix variable dereferenced before check Rashika Kheria
2013-10-30  2:35     ` Minchan Kim
2013-10-30 10:44     ` Jerome Marchand
2013-10-30  2:24   ` [PATCH v7 1/3] Staging: zram: Fix access of NULL pointer Minchan Kim
2013-10-30  2:36   ` Minchan Kim
2013-10-30 10:42   ` Jerome Marchand
2013-10-30 13:06 ` [PATCH v8 " Rashika Kheria
2013-10-30 13:10   ` [PATCH v8 2/3] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
2013-10-31  9:42     ` Weijie Yang
2013-10-31 11:56 ` [PATCH v9 1/2] Staging: zram: Fix access of NULL pointer Rashika Kheria
2013-10-31 11:58   ` [PATCH v9 2/2] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
2013-11-01  2:00     ` Minchan Kim
2013-11-01  8:54     ` Jerome Marchand
2013-11-01 14:13       ` Rashika Kheria
2013-11-01 14:06 ` [PATCH v10] Staging: zram: Fix memory leak by refcount mismatch Rashika Kheria
2013-11-10 15:45   ` Greg Kroah-Hartman
2013-11-10 15:56     ` [OPW kernel] " Rashika Kheria
2013-11-10 16:10       ` Greg Kroah-Hartman
2013-11-10 16:14         ` Rashika Kheria

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).