* [PATCH] scsi: iscsi: fix incorrect error path labels for flashnode operations
@ 2025-05-30 19:29 Alok Tiwari
2025-06-02 16:19 ` Mike Christie
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Alok Tiwari @ 2025-05-30 19:29 UTC (permalink / raw)
To: lduncan, cleech, michael.christie, James.Bottomley,
martin.petersen, open-iscsi, linux-scsi
Cc: alok.a.tiwari, linux-kernel, darren.kenny
Correct the error handling goto labels used when host lookup fails in
various flashnode-related event handlers:
- iscsi_new_flashnode()
- iscsi_del_flashnode()
- iscsi_login_flashnode()
- iscsi_logout_flashnode()
- iscsi_logout_flashnode_sid()
scsi_host_put() is not required when shost is NULL, so jumping to the
correct label avoids unnecessary operations. These functions previously
jumped to the wrong goto label (put_host), which did not match the
intended cleanup logic.
Updated to use the correct exit labels (exit_new_fnode, exit_del_fnode,
etc.) to ensure proper error handling.
Also removed the unused put_host label under iscsi_new_flashnode()
as it is no longer needed.
No functional changes beyond accurate error path correction.
Fixes: c6a4bb2ef596 ("[SCSI] scsi_transport_iscsi: Add flash node mgmt support")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
drivers/scsi/scsi_transport_iscsi.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 0b8c91bf793f..c75a806496d6 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -3499,7 +3499,7 @@ static int iscsi_new_flashnode(struct iscsi_transport *transport,
pr_err("%s could not find host no %u\n",
__func__, ev->u.new_flashnode.host_no);
err = -ENODEV;
- goto put_host;
+ goto exit_new_fnode;
}
index = transport->new_flashnode(shost, data, len);
@@ -3509,7 +3509,6 @@ static int iscsi_new_flashnode(struct iscsi_transport *transport,
else
err = -EIO;
-put_host:
scsi_host_put(shost);
exit_new_fnode:
@@ -3534,7 +3533,7 @@ static int iscsi_del_flashnode(struct iscsi_transport *transport,
pr_err("%s could not find host no %u\n",
__func__, ev->u.del_flashnode.host_no);
err = -ENODEV;
- goto put_host;
+ goto exit_del_fnode;
}
idx = ev->u.del_flashnode.flashnode_idx;
@@ -3576,7 +3575,7 @@ static int iscsi_login_flashnode(struct iscsi_transport *transport,
pr_err("%s could not find host no %u\n",
__func__, ev->u.login_flashnode.host_no);
err = -ENODEV;
- goto put_host;
+ goto exit_login_fnode;
}
idx = ev->u.login_flashnode.flashnode_idx;
@@ -3628,7 +3627,7 @@ static int iscsi_logout_flashnode(struct iscsi_transport *transport,
pr_err("%s could not find host no %u\n",
__func__, ev->u.logout_flashnode.host_no);
err = -ENODEV;
- goto put_host;
+ goto exit_logout_fnode;
}
idx = ev->u.logout_flashnode.flashnode_idx;
@@ -3678,7 +3677,7 @@ static int iscsi_logout_flashnode_sid(struct iscsi_transport *transport,
pr_err("%s could not find host no %u\n",
__func__, ev->u.logout_flashnode.host_no);
err = -ENODEV;
- goto put_host;
+ goto exit_logout_sid;
}
session = iscsi_session_lookup(ev->u.logout_flashnode_sid.sid);
--
2.47.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: iscsi: fix incorrect error path labels for flashnode operations
2025-05-30 19:29 [PATCH] scsi: iscsi: fix incorrect error path labels for flashnode operations Alok Tiwari
@ 2025-06-02 16:19 ` Mike Christie
2025-06-04 2:16 ` Martin K. Petersen
2025-06-10 2:06 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Mike Christie @ 2025-06-02 16:19 UTC (permalink / raw)
To: Alok Tiwari, lduncan, cleech, James.Bottomley, martin.petersen,
open-iscsi, linux-scsi
Cc: linux-kernel, darren.kenny
On 5/30/25 2:29 PM, Alok Tiwari wrote:
> Correct the error handling goto labels used when host lookup fails in
> various flashnode-related event handlers:
> - iscsi_new_flashnode()
> - iscsi_del_flashnode()
> - iscsi_login_flashnode()
> - iscsi_logout_flashnode()
> - iscsi_logout_flashnode_sid()
>
> scsi_host_put() is not required when shost is NULL, so jumping to the
> correct label avoids unnecessary operations. These functions previously
> jumped to the wrong goto label (put_host), which did not match the
> intended cleanup logic.
> Updated to use the correct exit labels (exit_new_fnode, exit_del_fnode,
> etc.) to ensure proper error handling.
> Also removed the unused put_host label under iscsi_new_flashnode()
> as it is no longer needed.
>
> No functional changes beyond accurate error path correction.
>
> Fixes: c6a4bb2ef596 ("[SCSI] scsi_transport_iscsi: Add flash node mgmt support")
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Thanks.
Reviewed-by: Mike Christie <michael.christie@oracle.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: iscsi: fix incorrect error path labels for flashnode operations
2025-05-30 19:29 [PATCH] scsi: iscsi: fix incorrect error path labels for flashnode operations Alok Tiwari
2025-06-02 16:19 ` Mike Christie
@ 2025-06-04 2:16 ` Martin K. Petersen
2025-06-10 2:06 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-06-04 2:16 UTC (permalink / raw)
To: Alok Tiwari
Cc: lduncan, cleech, michael.christie, James.Bottomley,
martin.petersen, open-iscsi, linux-scsi, linux-kernel,
darren.kenny
Alok,
> Correct the error handling goto labels used when host lookup fails in
> various flashnode-related event handlers:
> - iscsi_new_flashnode()
> - iscsi_del_flashnode()
> - iscsi_login_flashnode()
> - iscsi_logout_flashnode()
> - iscsi_logout_flashnode_sid()
Applied to 6.16/scsi-staging, thanks!
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: iscsi: fix incorrect error path labels for flashnode operations
2025-05-30 19:29 [PATCH] scsi: iscsi: fix incorrect error path labels for flashnode operations Alok Tiwari
2025-06-02 16:19 ` Mike Christie
2025-06-04 2:16 ` Martin K. Petersen
@ 2025-06-10 2:06 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-06-10 2:06 UTC (permalink / raw)
To: lduncan, cleech, michael.christie, James.Bottomley, open-iscsi,
linux-scsi, Alok Tiwari
Cc: Martin K . Petersen, linux-kernel, darren.kenny
On Fri, 30 May 2025 12:29:35 -0700, Alok Tiwari wrote:
> Correct the error handling goto labels used when host lookup fails in
> various flashnode-related event handlers:
> - iscsi_new_flashnode()
> - iscsi_del_flashnode()
> - iscsi_login_flashnode()
> - iscsi_logout_flashnode()
> - iscsi_logout_flashnode_sid()
>
> [...]
Applied to 6.16/scsi-fixes, thanks!
[1/1] scsi: iscsi: fix incorrect error path labels for flashnode operations
https://git.kernel.org/mkp/scsi/c/9b17621366d2
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-06-10 2:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-30 19:29 [PATCH] scsi: iscsi: fix incorrect error path labels for flashnode operations Alok Tiwari
2025-06-02 16:19 ` Mike Christie
2025-06-04 2:16 ` Martin K. Petersen
2025-06-10 2:06 ` 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