[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d112d30e-d144-4c76-db98-5de4767f5945@huaweicloud.com>
Date: Wed, 19 Jul 2023 09:09:41 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: Yu Kuai <yukuai1@...weicloud.com>, mhartmay@...ux.ibm.com,
bblock@...ux.ibm.com, bvanassche@....org, hch@....de,
axboe@...nel.dk
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
"yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH] scsi/sg: fix checking return value of blk_get_queue()
Hi, Jens
在 2023/07/05 10:40, Yu Kuai 写道:
> From: Yu Kuai <yukuai3@...wei.com>
>
> Commit fcaa174a9c99 ("scsi/sg: don't grab scsi host module reference")
> make a mess how blk_get_queue() is called, blk_get_queue() returns true
> on success while the caller expects it returns 0 on success.
>
> Fix this problem and also add a corresponding error message on failure.
>
> Fixes: fcaa174a9c99 ("scsi/sg: don't grab scsi host module reference")
> Reported-by: Marc Hartmayer <mhartmay@...ux.ibm.com>
> Closes: https://lore.kernel.org/all/87lefv622n.fsf@linux.ibm.com/
> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
Sorry about the trouble... Can you apply this patch? I notice that the
original patch is applied to stable.
Thanks,
Kuai
> ---
> drivers/scsi/sg.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
> index 89fa046c7158..0d8afffd1683 100644
> --- a/drivers/scsi/sg.c
> +++ b/drivers/scsi/sg.c
> @@ -1497,9 +1497,10 @@ sg_add_device(struct device *cl_dev)
> int error;
> unsigned long iflags;
>
> - error = blk_get_queue(scsidp->request_queue);
> - if (error)
> - return error;
> + if (!blk_get_queue(scsidp->request_queue)) {
> + pr_warn("%s: get scsi_device queue failed\n", __func__);
> + return -ENODEV;
> + }
>
> error = -ENOMEM;
> cdev = cdev_alloc();
>
Powered by blists - more mailing lists