Hi all, Today's linux-next merge of the rdma tree got conflicts in: drivers/infiniband/ulp/srpt/ib_srpt.h drivers/infiniband/ulp/srpt/ib_srpt.c between commits: 82d46dedf750a ("RDMA/srpt: bound the indirect descriptor table to the IU") 013eb66a8ef25 ("RDMA/srpt: widen the indirect RDMA context counters") from the rdma-fixes tree and commit: 317128ea4f21c ("RDMA/srpt: Prevent uninitialized read buffer disclosure") from the rdma tree. I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. diff --cc drivers/infiniband/ulp/srpt/ib_srpt.c index a2af0882eff5a,fc530ddf489ce..0000000000000 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@@ -1121,9 -1115,10 +1121,11 @@@ static int srpt_get_desc_tbl(struct srp } else if (((srp_cmd->buf_fmt & 0xf) == SRP_DATA_DESC_INDIRECT) || ((srp_cmd->buf_fmt >> 4) == SRP_DATA_DESC_INDIRECT)) { struct srp_indirect_buf *idb = srpt_get_desc_buf(srp_cmd); + u64 total_len = 0; int nbufs = be32_to_cpu(idb->table_desc.len) / sizeof(struct srp_direct_buf); + size_t desc_off = (uintptr_t)idb - (uintptr_t)srp_cmd; + int i; if (nbufs > (srp_cmd->data_out_desc_cnt + srp_cmd->data_in_desc_cnt)) { @@@ -1135,18 -1130,14 +1137,26 @@@ return -EINVAL; } + if (nbufs == 0) { + pr_err("received SRP_CMD with an empty indirect descriptor table\n"); + return -EINVAL; + } + + if (desc_off + struct_size(idb, desc_list, nbufs) > + recv_ioctx->byte_len) { + pr_err("received SRP_CMD indirect table (%d descriptors) that does not fit the %d-byte IU\n", + nbufs, recv_ioctx->byte_len); + return -EINVAL; + } + + for (i = 0; i < nbufs; i++) + total_len += be32_to_cpu(idb->desc_list[i].len); + if (total_len != be32_to_cpu(idb->len)) { + pr_err("SRP descriptor lengths total %llu does not match advertised length %u\n", + total_len, be32_to_cpu(idb->len)); + return -EINVAL; + } + *data_len = be32_to_cpu(idb->len); return srpt_alloc_rw_ctxs(ioctx, idb->desc_list, nbufs, sg, sg_cnt); diff --cc drivers/infiniband/ulp/srpt/ib_srpt.h index d9061aa65c1a8,78bba741489ec..0000000000000 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h @@@ -223,8 -224,9 +224,9 @@@ struct srpt_send_ioctx struct ib_cqe rdma_cqe; enum srpt_command_state state; struct se_cmd cmd; + u32 buf_len; - u8 n_rdma; - u8 n_rw_ctx; + int n_rdma; + int n_rw_ctx; bool queue_status_only; u8 sense_data[TRANSPORT_SENSE_BUFFER]; };