linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "zhengbin (A)" <zhengbin13@huawei.com>
To: <tim@cyberelk.net>, <axboe@kernel.dk>, <linux-block@vger.kernel.org>
Cc: <yi.zhang@huawei.com>
Subject: Re: [PATCH v2] paride/pcd: need to set queue to NULL before put_disk
Date: Wed, 4 Sep 2019 16:40:25 +0800	[thread overview]
Message-ID: <9b6086dd-ddfe-acfe-0d83-34c1b3351bac@huawei.com> (raw)
In-Reply-To: <1565695660-13459-1-git-send-email-zhengbin13@huawei.com>

ping

On 2019/8/13 19:27, zhengbin wrote:
> In pcd_init_units, if blk_mq_init_sq_queue fails, need to set queue to
> NULL before put_disk, otherwise null-ptr-deref Read will occur.
>
> put_disk
>   kobject_put
>     disk_release
>       blk_put_queue(disk->queue)
>
> Fixes: f0d176255401 ("paride/pcd: Fix potential NULL pointer dereference and mem leak")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: zhengbin <zhengbin13@huawei.com>
> ---
>  drivers/block/paride/pcd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
> index 001dbdc..bfca80d 100644
> --- a/drivers/block/paride/pcd.c
> +++ b/drivers/block/paride/pcd.c
> @@ -314,8 +314,8 @@ static void pcd_init_units(void)
>  		disk->queue = blk_mq_init_sq_queue(&cd->tag_set, &pcd_mq_ops,
>  						   1, BLK_MQ_F_SHOULD_MERGE);
>  		if (IS_ERR(disk->queue)) {
> -			put_disk(disk);
>  			disk->queue = NULL;
> +			put_disk(disk);
>  			continue;
>  		}
>
> --
> 2.7.4
>
>
> .
>


  reply	other threads:[~2019-09-04  8:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13 11:27 [PATCH v2] paride/pcd: need to set queue to NULL before put_disk zhengbin
2019-09-04  8:40 ` zhengbin (A) [this message]
2019-09-04 13:01 ` Jens Axboe

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=9b6086dd-ddfe-acfe-0d83-34c1b3351bac@huawei.com \
    --to=zhengbin13@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=tim@cyberelk.net \
    --cc=yi.zhang@huawei.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;
as well as URLs for NNTP newsgroup(s).