2020-06-15 08:14:01

by Jing Xiangfeng

[permalink] [raw]
Subject: [PATCH] scsi: iscsi: Do not put host in iscsi_set_flashnode_param()

If scsi_host_lookup() failes we will jump to put_host, which may
cause panic. Jump to exit_set_fnode to fix it.

Signed-off-by: Jing Xiangfeng <[email protected]>
---
drivers/scsi/scsi_transport_iscsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index f4cc08e..c5e99f9 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -3291,7 +3291,7 @@ static int iscsi_set_flashnode_param(struct iscsi_transport *transport,
pr_err("%s could not find host no %u\n",
__func__, ev->u.set_flashnode.host_no);
err = -ENODEV;
- goto put_host;
+ goto exit_set_fnode;
}

idx = ev->u.set_flashnode.flashnode_idx;
--
1.8.3.1


2020-07-26 05:35:43

by Mike Christie

[permalink] [raw]
Subject: Re: [PATCH] scsi: iscsi: Do not put host in iscsi_set_flashnode_param()

On 6/15/20 3:12 AM, Jing Xiangfeng wrote:
> If scsi_host_lookup() failes we will jump to put_host, which may
> cause panic. Jump to exit_set_fnode to fix it.
>
> Signed-off-by: Jing Xiangfeng <[email protected]>
> ---
> drivers/scsi/scsi_transport_iscsi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> index f4cc08e..c5e99f9 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -3291,7 +3291,7 @@ static int iscsi_set_flashnode_param(struct iscsi_transport *transport,
> pr_err("%s could not find host no %u\n",
> __func__, ev->u.set_flashnode.host_no);
> err = -ENODEV;
> - goto put_host;
> + goto exit_set_fnode;
> }
>
> idx = ev->u.set_flashnode.flashnode_idx;
>

Reviewed-by: Mike Christie <[email protected]>

2020-07-29 04:14:27

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi: iscsi: Do not put host in iscsi_set_flashnode_param()

On Mon, 15 Jun 2020 16:12:26 +0800, Jing Xiangfeng wrote:

> If scsi_host_lookup() failes we will jump to put_host, which may
> cause panic. Jump to exit_set_fnode to fix it.

Applied to 5.9/scsi-queue, thanks!

[1/1] scsi: iscsi: Do not put host in iscsi_set_flashnode_param()
https://git.kernel.org/mkp/scsi/c/68e12e5f6135

--
Martin K. Petersen Oracle Linux Engineering