Patch "IB/core: Make rdma_rw_ctx_init() initialize all used fields" has been added to the 4.7-stable tree
From: <gregkh@linuxfoundation.org>
Date: 2016-08-18 12:45:34
This is a note to let you know that I've just added the patch titled
IB/core: Make rdma_rw_ctx_init() initialize all used fields
to the 4.7-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ib-core-make-rdma_rw_ctx_init-initialize-all-used-fields.patch
and it can be found in the queue-4.7 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let [off-list ref] know about it.
From eaa74ec7329a48a4b724d8de440b3a2cbaabf7c8 Mon Sep 17 00:00:00 2001
From: Bart Van Assche <redacted>
Date: Thu, 21 Jul 2016 13:03:09 -0700
Subject: IB/core: Make rdma_rw_ctx_init() initialize all used fields
From: Bart Van Assche <redacted>
commit eaa74ec7329a48a4b724d8de440b3a2cbaabf7c8 upstream.
Some but not all callers of rdma_rw_ctx_init() zero-initialize
struct rdma_rw_ctx. Hence make rdma_rw_ctx_init() initialize all
work request fields that will be read by ib_post_send().
Fixes: a060b5629ab0 ("IB/core: generic RDMA READ/WRITE API")
Signed-off-by: Bart Van Assche <redacted>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Steve Wise <redacted>
Tested-by: Laurence Oberman <redacted>
Cc: Parav Pandit <redacted>
Cc: Nicholas Bellinger <redacted>
Signed-off-by: Doug Ledford <redacted>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/infiniband/core/rw.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
--- a/drivers/infiniband/core/rw.c
+++ b/drivers/infiniband/core/rw.c@@ -71,6 +71,7 @@ static inline u32 rdma_rw_fr_page_list_l return min_t(u32, dev->attrs.max_fast_reg_page_list_len, 256); } +/* Caller must have zero-initialized *reg. */ static int rdma_rw_init_one_mr(struct ib_qp *qp, u8 port_num, struct rdma_rw_reg_ctx *reg, struct scatterlist *sg, u32 sg_cnt, u32 offset)
@@ -114,6 +115,7 @@ static int rdma_rw_init_mr_wrs(struct rd u8 port_num, struct scatterlist *sg, u32 sg_cnt, u32 offset, u64 remote_addr, u32 rkey, enum dma_data_direction dir) { + struct rdma_rw_reg_ctx *prev = NULL; u32 pages_per_mr = rdma_rw_fr_page_list_len(qp->pd->device); int i, j, ret = 0, count = 0;
@@ -125,7 +127,6 @@ static int rdma_rw_init_mr_wrs(struct rd } for (i = 0; i < ctx->nr_ops; i++) { - struct rdma_rw_reg_ctx *prev = i ? &ctx->reg[i - 1] : NULL; struct rdma_rw_reg_ctx *reg = &ctx->reg[i]; u32 nents = min(sg_cnt, pages_per_mr);
@@ -162,9 +163,13 @@ static int rdma_rw_init_mr_wrs(struct rd sg_cnt -= nents; for (j = 0; j < nents; j++) sg = sg_next(sg); + prev = reg; offset = 0; } + if (prev) + prev->wr.wr.next = NULL; + ctx->type = RDMA_RW_MR; return count;
@@ -205,11 +210,10 @@ static int rdma_rw_init_map_wrs(struct r rdma_wr->wr.opcode = IB_WR_RDMA_READ; rdma_wr->remote_addr = remote_addr + total_len; rdma_wr->rkey = rkey; + rdma_wr->wr.num_sge = nr_sge; rdma_wr->wr.sg_list = sge; for (j = 0; j < nr_sge; j++, sg = sg_next(sg)) { - rdma_wr->wr.num_sge++; - sge->addr = ib_sg_dma_address(dev, sg) + offset; sge->length = ib_sg_dma_len(dev, sg) - offset; sge->lkey = qp->pd->local_dma_lkey;
@@ -220,8 +224,8 @@ static int rdma_rw_init_map_wrs(struct r offset = 0; } - if (i + 1 < ctx->nr_ops) - rdma_wr->wr.next = &ctx->map.wrs[i + 1].wr; + rdma_wr->wr.next = i + 1 < ctx->nr_ops ? + &ctx->map.wrs[i + 1].wr : NULL; } ctx->type = RDMA_RW_MULTI_WR;
Patches currently in stable-queue which might be from bart.vanassche@sandisk.com are queue-4.7/dm-set-dmf_suspended-_before_-clearing-dmf_noflush_suspending.patch queue-4.7/ib-core-make-rdma_rw_ctx_init-initialize-all-used-fields.patch queue-4.7/ib-rdmavt-disable-by-default.patch queue-4.7/ib-srpt-limit-the-number-of-sg-elements-per-work-request.patch queue-4.7/ib-core-rdma-rw-api-do-not-exceed-qp-sge-send-limit.patch