Makes ucma_query_path() check the length of the output buffer: this will prevent the function from writing past userspace provided buffer.
Signed-off-by: Yann Droneaud <[email protected]> Link: http://mid.gmane.org/[email protected] --- drivers/infiniband/core/ucma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index a155169..c653b1e 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -838,6 +838,9 @@ static ssize_t ucma_query_path(struct ucma_context *ctx, if (out_len < sizeof(*resp)) return -ENOSPC; + if ((out_len - sizeof(*resp))/sizeof(struct ib_path_rec_data) < ctx->cm_id->route.num_paths) + return -ENOSPC; + resp = kzalloc(out_len, GFP_KERNEL); if (!resp) return -ENOMEM; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
