From: Minchan Kim <minchan@kernel.org>
To: Rashika Kheria <rashika.kheria@gmail.com>
Cc: opw-kernel@googlegroups.com,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiang Liu <jiang.liu@huawei.com>, Nitin Gupta <ngupta@vflare.org>,
Jerome Marchand <jmarchand@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 1/3] Staging: zram: Fix access of NULL pointer
Date: Tue, 29 Oct 2013 09:43:38 +0900 [thread overview]
Message-ID: <20131029004338.GB17038@bbox> (raw)
In-Reply-To: <cc16130b4e23207971139eff313a4ec71f51c187.1382962788.git.rashika.kheria@gmail.com>
Hello Rashika,
On Mon, Oct 28, 2013 at 05:51:38PM +0530, Rashika Kheria wrote:
> This patch fixes the bug in reset_store caused by accessing NULL pointer.
> Hence, It introduces a check for bdev. It also removes unnecessary check
> of bdev for fsync_bdev().
It's better than old but I still want it more better.
First of all, I hope patch description is more clear in case of bugfix patch
because other maintainers from stable/distro or other people could understand
well so they could judge once again whether they need to backport or not.
If maintainer judge that it's not severe, even they couldn't backport.
Patch description includes followin as, at least.
1. When this bug happens?
2. What's the result of user POV?
3. How to fix it.
You were good for 2 and 3 but 1
I can help.
If memory pressure is severe, inode could be reclaimed.
In this case, bdget_disk can return NULL because allocation of inode
in bdget could fail.
I hope you could do better massage.
In addition, this bug have been for a long time so it deserves backporting to
stable tree. In such case, you could Cc stable tree with stable mark.
Please refer Documentation/stable_kernel_rules.txt and others patches
in LKML.
After this year kernel summit, it seems to change something rule for
marking stable but I thinks it's not solid so old rule still would be
valid.
Thanks!
>
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
> ---
>
> This revision fixes the following issues of the previous revision-
> Seperating patches into Bug fix and Smatch fix
>
> 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
>
> --
> 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
next prev parent reply other threads:[~2013-10-29 0:43 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20131019110539.GA25167@gmail.com>
2013-10-28 11:47 ` [PATCH v5 1/3] Staging: zram: Fix access of NULL pointer Rashika Kheria
2013-10-28 11:48 ` [PATCH v5 3/3] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
2013-10-28 12:17 ` [PATCH v5 2/3] Staging: zram: Fix variable dereferenced before check Rashika Kheria
2013-10-28 12:21 ` [PATCH v6 1/3] Staging: zram: Fix access of NULL pointer Rashika Kheria
2013-10-28 12:23 ` [PATCH v6 2/3] Staging: zram: Fix variable dereferenced before check Rashika Kheria
2013-10-29 0:44 ` Minchan Kim
2013-10-28 12:24 ` [PATCH v6 3/3] Staging: zram: Fix decrement of variable by calling bdput() Rashika Kheria
2013-10-29 0:47 ` Minchan Kim
2013-10-28 13:45 ` [PATCH v6 1/3] Staging: zram: Fix access of NULL pointer Weijie Yang
[not found] ` <CAMpEsFHO5yrwxK9q=hQtOxwC=0_p4BznBGjvomPgFZogwXABRA@mail.gmail.com>
2013-10-28 15:09 ` Weijie Yang
2013-10-29 0:43 ` Minchan Kim [this message]
2013-10-29 23:10 ` [PATCH v7 " 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-30 13:13 ` [PATCH v8 3/3] Staging: zram: Fix variable dereferenced before check Rashika Kheria
2013-10-30 16:36 ` Greg Kroah-Hartman
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131029004338.GB17038@bbox \
--to=minchan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jiang.liu@huawei.com \
--cc=jmarchand@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ngupta@vflare.org \
--cc=opw-kernel@googlegroups.com \
--cc=rashika.kheria@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox