[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CO6PR18MB44193EF2E69E60D525D72245D8679@CO6PR18MB4419.namprd18.prod.outlook.com>
Date: Mon, 24 Apr 2023 04:25:23 +0000
From: Manish Rangankar <mrangankar@...vell.com>
To: Peizhi Li <meetlpz@...t.edu.cn>,
Nilesh Javali <njavali@...vell.com>,
GR-QLogic-Storage-Upstream <GR-QLogic-Storage-Upstream@...vell.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>
CC: "hust-os-kernel-patches@...glegroups.com"
<hust-os-kernel-patches@...glegroups.com>,
Dongliang Mu <dzm91@...t.edu.cn>,
Dan Carpenter <dan.carpenter@...aro.org>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [EXT] [PATCH] scsi: qedi: qedi_main.c: modify the code flow in
'qedi_alloc_global_queues'
> -----Original Message-----
> From: Peizhi Li <meetlpz@...t.edu.cn>
> Sent: Saturday, April 22, 2023 3:46 PM
> To: Nilesh Javali <njavali@...vell.com>; Manish Rangankar
> <mrangankar@...vell.com>; GR-QLogic-Storage-Upstream <GR-QLogic-
> Storage-Upstream@...vell.com>; James E.J. Bottomley
> <jejb@...ux.ibm.com>; Martin K. Petersen <martin.petersen@...cle.com>
> Cc: hust-os-kernel-patches@...glegroups.com; Peizhi Li
> <meetlpz@...t.edu.cn>; Dongliang Mu <dzm91@...t.edu.cn>; Dan
> Carpenter <dan.carpenter@...aro.org>; linux-scsi@...r.kernel.org; linux-
> kernel@...r.kernel.org
> Subject: [EXT] [PATCH] scsi: qedi: qedi_main.c: modify the code flow in
> 'qedi_alloc_global_queues'
>
> External Email
>
> ----------------------------------------------------------------------
> When goto the mem_alloc_failure, it will result in a null pointer reference to
> variable 'gl' in function 'qedi_free_global_queues', due to the 'qedi-
> >global_queues' not being allocated.
>
> Fix this by returning -EINVAL directly.
>
> Signed-off-by: Peizhi Li <meetlpz@...t.edu.cn>
> Reviewed-by: Dongliang Mu <dzm91@...t.edu.cn>
> Reviewed-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
> The issue is found by static analysis and remains untested. Meanwhile, this
> patches is similar with qedf which Jinhong Zhu fixed already.
>
> https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__lore.kernel.org_all_20230417135518.184595-2D1-2Djinhongzhu-
> 40hust.edu.cn_&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=At6ko6G2bm
> E5NMB-6KMSliwRneAzZrOmmK21YHGCrqw&m=5ieD0l90bssMZBp8xnyd-
> eE3D1n_4P8CQfuaR8BW1hauGGhRlK891lfcT4e-
> UAyo&s=DshVk_3xiEVzwIyxpk90ObNr4U4lx6daDaS3uuN6t6g&e=
> drivers/scsi/qedi/qedi_main.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
> index f2ee49756df8..34f38e0f1c7d 100644
> --- a/drivers/scsi/qedi/qedi_main.c
> +++ b/drivers/scsi/qedi/qedi_main.c
> @@ -1637,8 +1637,7 @@ static int qedi_alloc_global_queues(struct qedi_ctx
> *qedi)
> * addresses of our queues
> */
> if (!qedi->p_cpuq) {
> - status = -EINVAL;
> - goto mem_alloc_failure;
> + return -EINVAL;
> }
>
> qedi->global_queues = kzalloc((sizeof(struct global_queue *) *
> --
> 2.25.1
Thanks,
Acked-by: Manish Rangankar <mrangankar@...vell.com>
Powered by blists - more mailing lists