Skip to content

Commit f6eed15

Browse files
Sergey Gorenkomartinkpetersen
authored andcommitted
scsi: iscsi: Exclude zero from the endpoint ID range
The kernel returns an endpoint ID as r.ep_connect_ret.handle in the iscsi_uevent. The iscsid validates a received endpoint ID and treats zero as an error. The commit referenced in the fixes line changed the endpoint ID range, and zero is always assigned to the first endpoint ID. So, the first attempt to create a new iSER connection always fails. Link: https://lore.kernel.org/r/20220613123854.55073-1-sergeygo@nvidia.com Fixes: 3c6ae37 ("scsi: iscsi: Release endpoint ID when its freed") Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com> Reviewed-by: Mike Christie <michael.christie@oracle.com> Reviewed-by: Lee Duncan <lduncan@suse.com> Signed-off-by: Sergey Gorenko <sergeygo@nvidia.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 566d3c5 commit f6eed15

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

drivers/scsi/scsi_transport_iscsi.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,12 @@ iscsi_create_endpoint(int dd_size)
212212
return NULL;
213213

214214
mutex_lock(&iscsi_ep_idr_mutex);
215-
id = idr_alloc(&iscsi_ep_idr, ep, 0, -1, GFP_NOIO);
215+
216+
/*
217+
* First endpoint id should be 1 to comply with user space
218+
* applications (iscsid).
219+
*/
220+
id = idr_alloc(&iscsi_ep_idr, ep, 1, -1, GFP_NOIO);
216221
if (id < 0) {
217222
mutex_unlock(&iscsi_ep_idr_mutex);
218223
printk(KERN_ERR "Could not allocate endpoint ID. Error %d.\n",

0 commit comments

Comments
 (0)