net/vmxnet3: reallocate shared memzone on re-config
authorYong Wang <yongwang@vmware.com>
Mon, 29 Aug 2016 19:18:47 +0000 (12:18 -0700)
committerBruce Richardson <bruce.richardson@intel.com>
Fri, 30 Sep 2016 10:27:18 +0000 (12:27 +0200)
commit8618d19b52b1999d237750274eae16c95400b0d2
tree30e4d10dcefe4cb410f59b8d81991a44ae17a674
parentc346551e5e601c20a4394c3e17a156eb431207e9
net/vmxnet3: reallocate shared memzone on re-config

When adding a DPDK port to ovs-vswitchd with DPDK, the vmxnet3 device
fails to activate due to mismatched magic number.  This failure causes
following operations to run: start the port, stop the port,
reconfigure and re-start the port.

During reconfigure, if there is an existing memzone, driver will reuse
it. But reconfigure may request different number of Tx/Rx queues.
This results in a memzone with wrong size and potential invalid memory
access.

To fix this, free the memzone if found and reserve a new one.

Signed-off-by: Yong Wang <yongwang@vmware.com>
Reviewed-by: Guolin Yang <gyang@vmware.com>
Reviewed-by: Daniele Di Proietto <ddiproietto@vmware.com>
Tested-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
drivers/net/vmxnet3/vmxnet3_ethdev.c