linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: qedi: fix error return code of qedi_alloc_global_queues()
@ 2021-03-08  3:30 Jia-Ju Bai
  2021-03-22 14:43 ` [EXT] " Manish Rangankar
  2021-03-25  3:53 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Jia-Ju Bai @ 2021-03-08  3:30 UTC (permalink / raw)
  To: njavali, mrangankar, jejb, martin.petersen
  Cc: GR-QLogic-Storage-Upstream, linux-scsi, linux-kernel, Jia-Ju Bai

When kzalloc() returns NULL to qedi->global_queues[i], no error return
code of qedi_alloc_global_queues() is assigned.
To fix this bug, status is assigned with -ENOMEM in this case.

Fixes: ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/scsi/qedi/qedi_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index 47ad64b06623..69c5b5ee2169 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -1675,6 +1675,7 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
 		if (!qedi->global_queues[i]) {
 			QEDI_ERR(&qedi->dbg_ctx,
 				 "Unable to allocation global queue %d.\n", i);
+			status = -ENOMEM;
 			goto mem_alloc_failure;
 		}
 
-- 
2.17.1


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

* RE: [EXT] [PATCH] scsi: qedi: fix error return code of qedi_alloc_global_queues()
  2021-03-08  3:30 [PATCH] scsi: qedi: fix error return code of qedi_alloc_global_queues() Jia-Ju Bai
@ 2021-03-22 14:43 ` Manish Rangankar
  2021-03-25  3:53 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Manish Rangankar @ 2021-03-22 14:43 UTC (permalink / raw)
  To: Jia-Ju Bai, Nilesh Javali, jejb, martin.petersen
  Cc: GR-QLogic-Storage-Upstream, linux-scsi, linux-kernel


> -----Original Message-----
> From: Jia-Ju Bai <baijiaju1990@gmail.com>
> Sent: Monday, March 8, 2021 9:00 AM
> To: Nilesh Javali <njavali@marvell.com>; Manish Rangankar
> <mrangankar@marvell.com>; jejb@linux.ibm.com;
> martin.petersen@oracle.com
> Cc: GR-QLogic-Storage-Upstream <GR-QLogic-Storage-
> Upstream@marvell.com>; linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org; Jia-Ju Bai <baijiaju1990@gmail.com>
> Subject: [EXT] [PATCH] scsi: qedi: fix error return code of
> qedi_alloc_global_queues()
> 
> External Email
> 
> ----------------------------------------------------------------------
> When kzalloc() returns NULL to qedi->global_queues[i], no error return code of
> qedi_alloc_global_queues() is assigned.
> To fix this bug, status is assigned with -ENOMEM in this case.
> 
> Fixes: ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver
> framework.")
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
>  drivers/scsi/qedi/qedi_main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index
> 47ad64b06623..69c5b5ee2169 100644
> --- a/drivers/scsi/qedi/qedi_main.c
> +++ b/drivers/scsi/qedi/qedi_main.c
> @@ -1675,6 +1675,7 @@ static int qedi_alloc_global_queues(struct qedi_ctx
> *qedi)
>  		if (!qedi->global_queues[i]) {
>  			QEDI_ERR(&qedi->dbg_ctx,
>  				 "Unable to allocation global queue %d.\n", i);
> +			status = -ENOMEM;
>  			goto mem_alloc_failure;
>  		}
> 
> --
> 2.17.1

Thanks,
Acked-by: Manish Rangankar <mrangankar@marvell.com>

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

* Re: [PATCH] scsi: qedi: fix error return code of qedi_alloc_global_queues()
  2021-03-08  3:30 [PATCH] scsi: qedi: fix error return code of qedi_alloc_global_queues() Jia-Ju Bai
  2021-03-22 14:43 ` [EXT] " Manish Rangankar
@ 2021-03-25  3:53 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-03-25  3:53 UTC (permalink / raw)
  To: mrangankar, njavali, Jia-Ju Bai, jejb
  Cc: Martin K . Petersen, linux-scsi, linux-kernel,
	GR-QLogic-Storage-Upstream

On Sun, 7 Mar 2021 19:30:24 -0800, Jia-Ju Bai wrote:

> When kzalloc() returns NULL to qedi->global_queues[i], no error return
> code of qedi_alloc_global_queues() is assigned.
> To fix this bug, status is assigned with -ENOMEM in this case.

Applied to 5.12/scsi-fixes, thanks!

[1/1] scsi: qedi: fix error return code of qedi_alloc_global_queues()
      https://git.kernel.org/mkp/scsi/c/f69953837ca5

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-03-25  3:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08  3:30 [PATCH] scsi: qedi: fix error return code of qedi_alloc_global_queues() Jia-Ju Bai
2021-03-22 14:43 ` [EXT] " Manish Rangankar
2021-03-25  3:53 ` Martin K. Petersen

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).