DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] bus/vmbus: calcuate the correct start address for mapping ring buffer
@ 2020-06-12  0:48 longli
  2020-06-12 16:06 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: longli @ 2020-06-12  0:48 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, Long Li

From: Long Li <longli@microsoft.com>

vmbus_map_addr is used as the next start virutal 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.

Signed-off-by: Long Li <longli@microsoft.com>
---
 drivers/bus/vmbus/linux/vmbus_uio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 5451bfd15..5dc0c47de 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;
 }
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] bus/vmbus: calcuate the correct start address for mapping ring buffer
  2020-06-12  0:48 [dpdk-dev] [PATCH] bus/vmbus: calcuate the correct start address for mapping ring buffer longli
@ 2020-06-12 16:06 ` Stephen Hemminger
  2020-06-24 23:05   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2020-06-12 16:06 UTC (permalink / raw)
  To: longli; +Cc: Stephen Hemminger, dev, Long Li

On Thu, 11 Jun 2020 17:48:25 -0700
longli@linuxonhyperv.com wrote:

> From: Long Li <longli@microsoft.com>
> 
> vmbus_map_addr is used as the next start virutal 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.
> 
> Signed-off-by: Long Li <longli@microsoft.com>


Fixes: 3f9277031a2e ("bus/vmbus: fix check for mmap failure")
Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] bus/vmbus: calcuate the correct start address for mapping ring buffer
  2020-06-12 16:06 ` Stephen Hemminger
@ 2020-06-24 23:05   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2020-06-24 23:05 UTC (permalink / raw)
  To: Long Li; +Cc: dev, Stephen Hemminger, Stephen Hemminger, stable

12/06/2020 18:06, Stephen Hemminger:
> On Thu, 11 Jun 2020 17:48:25 -0700
> longli@linuxonhyperv.com wrote:
> 
> > From: Long Li <longli@microsoft.com>
> > 
> > vmbus_map_addr is used as the next start virutal 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.
> > 
> > Signed-off-by: Long Li <longli@microsoft.com>
> 
> 
> Fixes: 3f9277031a2e ("bus/vmbus: fix check for mmap failure")
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>

+Cc: stable@dpdk.org

Applied, thanks



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-24 23:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-12  0:48 [dpdk-dev] [PATCH] bus/vmbus: calcuate the correct start address for mapping ring buffer longli
2020-06-12 16:06 ` Stephen Hemminger
2020-06-24 23:05   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).