Skip to content

Commit 0c8cbcd

Browse files
committed
Merge tag 'nfs-rdma-for-4.16-2' of git://git.linux-nfs.org/projects/anna/linux-nfs
NFS-over-RDMA client fixes for Linux 4.16 #2 Stable fixes: - Fix calculating ri_max_send_sges, which can oops if max_sge is too small - Fix a BUG after device removal if freed resources haven't been allocated yet
2 parents 9b30889 + e89e8d8 commit 0c8cbcd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

net/sunrpc/xprtrdma/rpc_rdma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static bool rpcrdma_args_inline(struct rpcrdma_xprt *r_xprt,
143143
if (xdr->page_len) {
144144
remaining = xdr->page_len;
145145
offset = offset_in_page(xdr->page_base);
146-
count = 0;
146+
count = RPCRDMA_MIN_SEND_SGES;
147147
while (remaining) {
148148
remaining -= min_t(unsigned int,
149149
PAGE_SIZE - offset, remaining);

net/sunrpc/xprtrdma/verbs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
505505
pr_warn("rpcrdma: HCA provides only %d send SGEs\n", max_sge);
506506
return -ENOMEM;
507507
}
508-
ia->ri_max_send_sges = max_sge - RPCRDMA_MIN_SEND_SGES;
508+
ia->ri_max_send_sges = max_sge;
509509

510510
if (ia->ri_device->attrs.max_qp_wr <= RPCRDMA_BACKWARD_WRS) {
511511
dprintk("RPC: %s: insufficient wqe's available\n",
@@ -1502,6 +1502,9 @@ __rpcrdma_dma_map_regbuf(struct rpcrdma_ia *ia, struct rpcrdma_regbuf *rb)
15021502
static void
15031503
rpcrdma_dma_unmap_regbuf(struct rpcrdma_regbuf *rb)
15041504
{
1505+
if (!rb)
1506+
return;
1507+
15051508
if (!rpcrdma_regbuf_is_mapped(rb))
15061509
return;
15071510

@@ -1517,9 +1520,6 @@ rpcrdma_dma_unmap_regbuf(struct rpcrdma_regbuf *rb)
15171520
void
15181521
rpcrdma_free_regbuf(struct rpcrdma_regbuf *rb)
15191522
{
1520-
if (!rb)
1521-
return;
1522-
15231523
rpcrdma_dma_unmap_regbuf(rb);
15241524
kfree(rb);
15251525
}

0 commit comments

Comments
 (0)