scsi: iscsi: Fix incorrect error path labels for flashnode operations
[ Upstream commit 9b17621366d210ffee83262a8754086ebbde5e55 ]
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: c6a4bb2ef5
("[SCSI] scsi_transport_iscsi: Add flash node mgmt support")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Link: https://lore.kernel.org/r/20250530193012.3312911-1-alok.a.tiwari@oracle.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
581b7c3d80
commit
d4cbcf274c
@@ -3525,7 +3525,7 @@ static int iscsi_new_flashnode(struct iscsi_transport *transport,
|
|||||||
pr_err("%s could not find host no %u\n",
|
pr_err("%s could not find host no %u\n",
|
||||||
__func__, ev->u.new_flashnode.host_no);
|
__func__, ev->u.new_flashnode.host_no);
|
||||||
err = -ENODEV;
|
err = -ENODEV;
|
||||||
goto put_host;
|
goto exit_new_fnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
index = transport->new_flashnode(shost, data, len);
|
index = transport->new_flashnode(shost, data, len);
|
||||||
@@ -3535,7 +3535,6 @@ static int iscsi_new_flashnode(struct iscsi_transport *transport,
|
|||||||
else
|
else
|
||||||
err = -EIO;
|
err = -EIO;
|
||||||
|
|
||||||
put_host:
|
|
||||||
scsi_host_put(shost);
|
scsi_host_put(shost);
|
||||||
|
|
||||||
exit_new_fnode:
|
exit_new_fnode:
|
||||||
@@ -3560,7 +3559,7 @@ static int iscsi_del_flashnode(struct iscsi_transport *transport,
|
|||||||
pr_err("%s could not find host no %u\n",
|
pr_err("%s could not find host no %u\n",
|
||||||
__func__, ev->u.del_flashnode.host_no);
|
__func__, ev->u.del_flashnode.host_no);
|
||||||
err = -ENODEV;
|
err = -ENODEV;
|
||||||
goto put_host;
|
goto exit_del_fnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
idx = ev->u.del_flashnode.flashnode_idx;
|
idx = ev->u.del_flashnode.flashnode_idx;
|
||||||
@@ -3602,7 +3601,7 @@ static int iscsi_login_flashnode(struct iscsi_transport *transport,
|
|||||||
pr_err("%s could not find host no %u\n",
|
pr_err("%s could not find host no %u\n",
|
||||||
__func__, ev->u.login_flashnode.host_no);
|
__func__, ev->u.login_flashnode.host_no);
|
||||||
err = -ENODEV;
|
err = -ENODEV;
|
||||||
goto put_host;
|
goto exit_login_fnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
idx = ev->u.login_flashnode.flashnode_idx;
|
idx = ev->u.login_flashnode.flashnode_idx;
|
||||||
@@ -3654,7 +3653,7 @@ static int iscsi_logout_flashnode(struct iscsi_transport *transport,
|
|||||||
pr_err("%s could not find host no %u\n",
|
pr_err("%s could not find host no %u\n",
|
||||||
__func__, ev->u.logout_flashnode.host_no);
|
__func__, ev->u.logout_flashnode.host_no);
|
||||||
err = -ENODEV;
|
err = -ENODEV;
|
||||||
goto put_host;
|
goto exit_logout_fnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
idx = ev->u.logout_flashnode.flashnode_idx;
|
idx = ev->u.logout_flashnode.flashnode_idx;
|
||||||
@@ -3704,7 +3703,7 @@ static int iscsi_logout_flashnode_sid(struct iscsi_transport *transport,
|
|||||||
pr_err("%s could not find host no %u\n",
|
pr_err("%s could not find host no %u\n",
|
||||||
__func__, ev->u.logout_flashnode.host_no);
|
__func__, ev->u.logout_flashnode.host_no);
|
||||||
err = -ENODEV;
|
err = -ENODEV;
|
||||||
goto put_host;
|
goto exit_logout_sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
session = iscsi_session_lookup(ev->u.logout_flashnode_sid.sid);
|
session = iscsi_session_lookup(ev->u.logout_flashnode_sid.sid);
|
||||||
|
Reference in New Issue
Block a user