Commit 256b7ad2 authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Doug Ledford

IB/iser: Use pd->local_dma_lkey

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: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent b37c788f
...@@ -209,7 +209,7 @@ iser_initialize_task_headers(struct iscsi_task *task, ...@@ -209,7 +209,7 @@ iser_initialize_task_headers(struct iscsi_task *task,
tx_desc->dma_addr = dma_addr; tx_desc->dma_addr = dma_addr;
tx_desc->tx_sg[0].addr = tx_desc->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].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; iser_task->iser_conn = iser_conn;
out: out:
......
...@@ -284,7 +284,7 @@ int iser_alloc_rx_descriptors(struct iser_conn *iser_conn, ...@@ -284,7 +284,7 @@ int iser_alloc_rx_descriptors(struct iser_conn *iser_conn,
rx_sg = &rx_desc->rx_sg; rx_sg = &rx_desc->rx_sg;
rx_sg->addr = rx_desc->dma_addr; rx_sg->addr = rx_desc->dma_addr;
rx_sg->length = ISER_RX_PAYLOAD_SIZE; 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; iser_conn->rx_desc_head = 0;
...@@ -538,7 +538,7 @@ int iser_send_control(struct iscsi_conn *conn, ...@@ -538,7 +538,7 @@ int iser_send_control(struct iscsi_conn *conn,
tx_dsg->addr = iser_conn->login_req_dma; tx_dsg->addr = iser_conn->login_req_dma;
tx_dsg->length = task->data_count; tx_dsg->length = task->data_count;
tx_dsg->lkey = device->mr->lkey; tx_dsg->lkey = device->pd->local_dma_lkey;
mdesc->num_sge = 2; mdesc->num_sge = 2;
} }
......
...@@ -471,7 +471,7 @@ iser_reg_dma(struct iser_device *device, struct iser_data_buf *mem, ...@@ -471,7 +471,7 @@ iser_reg_dma(struct iser_device *device, struct iser_data_buf *mem,
{ {
struct scatterlist *sg = mem->sg; 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->rkey = device->mr->rkey;
reg->sge.addr = ib_sg_dma_address(device->ib_device, &sg[0]); reg->sge.addr = ib_sg_dma_address(device->ib_device, &sg[0]);
reg->sge.length = ib_sg_dma_len(device->ib_device, &sg[0]); reg->sge.length = ib_sg_dma_len(device->ib_device, &sg[0]);
......
...@@ -1061,7 +1061,7 @@ int iser_post_recvl(struct iser_conn *iser_conn) ...@@ -1061,7 +1061,7 @@ int iser_post_recvl(struct iser_conn *iser_conn)
sge.addr = iser_conn->login_resp_dma; sge.addr = iser_conn->login_resp_dma;
sge.length = ISER_RX_LOGIN_SIZE; 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.wr_id = (uintptr_t)iser_conn->login_resp_buf;
rx_wr.sg_list = &sge; rx_wr.sg_list = &sge;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment