diff mbox series

scsi: iscsi: start endpoint ID allocation from 1

Message ID 20220612121901.6897-1-varun@chelsio.com
State New
Headers show
Series scsi: iscsi: start endpoint ID allocation from 1 | expand

Commit Message

Varun Prakash June 12, 2022, 12:19 p.m. UTC
ktransport_ep_connect() (defined in open-iscsi/usr/netlink.c)
returns -EIO if endpoint ID is 0.

int
ktransport_ep_connect(iscsi_conn_t *conn, int non_blocking)
{
	...
	rc = __kipc_call(iov, 2);
	if (rc < 0)
		return rc;

	if (!ev->r.ep_connect_ret.handle)
		return -EIO;

	conn->transport_ep_handle = ev->r.ep_connect_ret.handle;
	...
}

Fixes: 3c6ae371b8a1 ("scsi: iscsi: Release endpoint ID when its freed")
Signed-off-by: Varun Prakash <varun@chelsio.com>
---
 drivers/scsi/scsi_transport_iscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mike Christie June 13, 2022, 3:34 p.m. UTC | #1
On 6/12/22 12:04 PM, Mike Christie wrote:
> On 6/12/22 7:19 AM, Varun Prakash wrote:
>> ktransport_ep_connect() (defined in open-iscsi/usr/netlink.c)
>> returns -EIO if endpoint ID is 0.
>>
>> int
>> ktransport_ep_connect(iscsi_conn_t *conn, int non_blocking)
>> {
>> 	...
>> 	rc = __kipc_call(iov, 2);
>> 	if (rc < 0)
>> 		return rc;
>>
>> 	if (!ev->r.ep_connect_ret.handle)
>> 		return -EIO;
>>
>> 	conn->transport_ep_handle = ev->r.ep_connect_ret.handle;
>> 	...
>> }
>>
>> Fixes: 3c6ae371b8a1 ("scsi: iscsi: Release endpoint ID when its freed")
>> Signed-off-by: Varun Prakash <varun@chelsio.com>
> 
> Thanks.
> 
> Ccing Nilesh because qedi was hitting this. I had just sent him a patch for
> this with some other patches.
> 
> Reviewed-by: Mike Christie <michael.christie@oracle.com>

Martin, Ignore my review-by. We are going to go with Sergey's patch:

[PATCH] scsi: iscsi: Exclude zero from the endpoint ID range
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 2c0dd64159b0..5ad69c65cbe0 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -212,7 +212,7 @@  iscsi_create_endpoint(int dd_size)
 		return NULL;
 
 	mutex_lock(&iscsi_ep_idr_mutex);
-	id = idr_alloc(&iscsi_ep_idr, ep, 0, -1, GFP_NOIO);
+	id = idr_alloc(&iscsi_ep_idr, ep, 1, -1, GFP_NOIO);
 	if (id < 0) {
 		mutex_unlock(&iscsi_ep_idr_mutex);
 		printk(KERN_ERR "Could not allocate endpoint ID. Error %d.\n",