From: Long Li Date: Fri, 12 Jun 2020 00:48:25 +0000 (-0700) Subject: bus/vmbus: fix ring buffer mapping X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1aef0aef3615d8b8d9d82cbb2d42afc2ae2bce7f;p=dpdk.git bus/vmbus: fix ring buffer mapping vmbus_map_addr is used as the next start virtual address for mapping ring buffer. However it's updated based on ring_buf, which is a pointer to an address on the stack. The next ring buffer may be mapped to an unexpected address. Fix this by calculating vmbus_map_addr based on returned virtual address. Fixes: 3f9277031a2e ("bus/vmbus: fix check for mmap failure") Cc: stable@dpdk.org Signed-off-by: Long Li Acked-by: Stephen Hemminger --- diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c index 5451bfd150..5dc0c47de6 100644 --- a/drivers/bus/vmbus/linux/vmbus_uio.c +++ b/drivers/bus/vmbus/linux/vmbus_uio.c @@ -242,7 +242,7 @@ static int vmbus_uio_map_subchan(const struct rte_vmbus_device *dev, *ring_size = file_size / 2; *ring_buf = mapaddr; - vmbus_map_addr = RTE_PTR_ADD(ring_buf, file_size); + vmbus_map_addr = RTE_PTR_ADD(mapaddr, file_size); return 0; }