IB/iser: Use pd->local_dma_lkey
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Thu, 30 Jul 2015 23:22:20 +0000 (17:22 -0600)
committerDoug Ledford <dledford@redhat.com>
Sun, 30 Aug 2015 22:12:34 +0000 (18:12 -0400)
Replace all leys with  pd->local_dma_lkey. This driver does not support
iWarp, so this is safe.

The insecure use of ib_get_dma_mr is thus isolated to an rkey, and this
looks trivially fixed by forcing the use of registration in a future
patch.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/ulp/iser/iscsi_iser.c
drivers/infiniband/ulp/iser/iser_initiator.c
drivers/infiniband/ulp/iser/iser_memory.c
drivers/infiniband/ulp/iser/iser_verbs.c

index e908a1eb800b97e31b7e8443d069fa5a26d1a92f..1ace5d83a4d761b82ffbe446bbf41a1f051cd66b 100644 (file)
@@ -209,7 +209,7 @@ iser_initialize_task_headers(struct iscsi_task *task,
        tx_desc->dma_addr = dma_addr;
        tx_desc->tx_sg[0].addr   = tx_desc->dma_addr;
        tx_desc->tx_sg[0].length = ISER_HEADERS_LEN;
-       tx_desc->tx_sg[0].lkey   = device->mr->lkey;
+       tx_desc->tx_sg[0].lkey   = device->pd->local_dma_lkey;
 
        iser_task->iser_conn = iser_conn;
 out:
index 0b1f3b54a0c1790f14ac39815ee0f2db9a8d808a..d511879d8cdfc862765f871b0876b43307e3b7c7 100644 (file)
@@ -284,7 +284,7 @@ int iser_alloc_rx_descriptors(struct iser_conn *iser_conn,
                rx_sg = &rx_desc->rx_sg;
                rx_sg->addr   = rx_desc->dma_addr;
                rx_sg->length = ISER_RX_PAYLOAD_SIZE;
-               rx_sg->lkey   = device->mr->lkey;
+               rx_sg->lkey   = device->pd->local_dma_lkey;
        }
 
        iser_conn->rx_desc_head = 0;
@@ -538,7 +538,7 @@ int iser_send_control(struct iscsi_conn *conn,
 
                tx_dsg->addr    = iser_conn->login_req_dma;
                tx_dsg->length  = task->data_count;
-               tx_dsg->lkey    = device->mr->lkey;
+               tx_dsg->lkey    = device->pd->local_dma_lkey;
                mdesc->num_sge = 2;
        }
 
index 09640c811fdd5cddc8608552063fe1dd4fec01f2..2493cc748db839b4ec885b82e5292633f242ad01 100644 (file)
@@ -471,7 +471,7 @@ iser_reg_dma(struct iser_device *device, struct iser_data_buf *mem,
 {
        struct scatterlist *sg = mem->sg;
 
-       reg->sge.lkey = device->mr->lkey;
+       reg->sge.lkey = device->pd->local_dma_lkey;
        reg->rkey = device->mr->rkey;
        reg->sge.addr = ib_sg_dma_address(device->ib_device, &sg[0]);
        reg->sge.length = ib_sg_dma_len(device->ib_device, &sg[0]);
index 6f5be47a6b90c785a7e71b5e9214bfc8b3a5015e..ad2d2b50cd7f09449d810196b58d47330719d9bf 100644 (file)
@@ -1061,7 +1061,7 @@ int iser_post_recvl(struct iser_conn *iser_conn)
 
        sge.addr   = iser_conn->login_resp_dma;
        sge.length = ISER_RX_LOGIN_SIZE;
-       sge.lkey   = ib_conn->device->mr->lkey;
+       sge.lkey   = ib_conn->device->pd->local_dma_lkey;
 
        rx_wr.wr_id   = (uintptr_t)iser_conn->login_resp_buf;
        rx_wr.sg_list = &sge;