Skip to content

Commit 9b17621

Browse files
aloktiwamartinkpetersen
authored andcommitted
scsi: iscsi: Fix incorrect error path labels for flashnode operations
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. Use the correct exit labels (exit_new_fnode, exit_del_fnode, etc.) to ensure proper error handling. Also remove the unused put_host label under iscsi_new_flashnode() as it is no longer needed. No functional changes beyond accurate error path correction. Fixes: c6a4bb2 ("[SCSI] scsi_transport_iscsi: Add flash node mgmt support") Signed-off-by: Alok Tiwari <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent ad0f548 commit 9b17621

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/scsi/scsi_transport_iscsi.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3499,7 +3499,7 @@ static int iscsi_new_flashnode(struct iscsi_transport *transport,
34993499
pr_err("%s could not find host no %u\n",
35003500
__func__, ev->u.new_flashnode.host_no);
35013501
err = -ENODEV;
3502-
goto put_host;
3502+
goto exit_new_fnode;
35033503
}
35043504

35053505
index = transport->new_flashnode(shost, data, len);
@@ -3509,7 +3509,6 @@ static int iscsi_new_flashnode(struct iscsi_transport *transport,
35093509
else
35103510
err = -EIO;
35113511

3512-
put_host:
35133512
scsi_host_put(shost);
35143513

35153514
exit_new_fnode:
@@ -3534,7 +3533,7 @@ static int iscsi_del_flashnode(struct iscsi_transport *transport,
35343533
pr_err("%s could not find host no %u\n",
35353534
__func__, ev->u.del_flashnode.host_no);
35363535
err = -ENODEV;
3537-
goto put_host;
3536+
goto exit_del_fnode;
35383537
}
35393538

35403539
idx = ev->u.del_flashnode.flashnode_idx;
@@ -3576,7 +3575,7 @@ static int iscsi_login_flashnode(struct iscsi_transport *transport,
35763575
pr_err("%s could not find host no %u\n",
35773576
__func__, ev->u.login_flashnode.host_no);
35783577
err = -ENODEV;
3579-
goto put_host;
3578+
goto exit_login_fnode;
35803579
}
35813580

35823581
idx = ev->u.login_flashnode.flashnode_idx;
@@ -3628,7 +3627,7 @@ static int iscsi_logout_flashnode(struct iscsi_transport *transport,
36283627
pr_err("%s could not find host no %u\n",
36293628
__func__, ev->u.logout_flashnode.host_no);
36303629
err = -ENODEV;
3631-
goto put_host;
3630+
goto exit_logout_fnode;
36323631
}
36333632

36343633
idx = ev->u.logout_flashnode.flashnode_idx;
@@ -3678,7 +3677,7 @@ static int iscsi_logout_flashnode_sid(struct iscsi_transport *transport,
36783677
pr_err("%s could not find host no %u\n",
36793678
__func__, ev->u.logout_flashnode.host_no);
36803679
err = -ENODEV;
3681-
goto put_host;
3680+
goto exit_logout_sid;
36823681
}
36833682

36843683
session = iscsi_session_lookup(ev->u.logout_flashnode_sid.sid);

0 commit comments

Comments
 (0)