Skip to contentSkip to conversation

scsi: iscsi: start endpoint ID allocation from 1

PATCH In review Varun Prakash 2 participants 3 messages Jun 12, 2022 – Jun 13, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: iscsi: start endpoint ID allocation from 1

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")
---
 drivers/scsi/scsi_transport_iscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_transport_iscsi.c +1 -1
index 2c0dd64159b0..5ad69c65cbe0 100644
@@ -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",
Signature · 1 line
2.27.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Varun Prakash

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;
	...
}
Quoted 2 lines
Fixes 3c6ae371b8a1 ("scsi: iscsi: Release endpoint ID when its freed")

Thanks.

Ccing Nilesh because qedi was hitting this. I had just sent him a patch for this with some other patches.

#2 lore raw
Quoted 22 lines · Mike Christie
Quoted 18 lines · Varun Prakash

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;
	...
}
Quoted 2 lines
Fixes 3c6ae371b8a1 ("scsi: iscsi: Release endpoint ID when its freed")
Quoted 6 lines

Thanks.

Ccing Nilesh because qedi was hitting this. I had just sent him a patch for this with some other patches.

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

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