net/virtio: fix memory leak when reinitializing device
authorOlivier Matz <olivier.matz@6wind.com>
Tue, 23 Jan 2018 15:54:41 +0000 (16:54 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 29 Jan 2018 09:04:28 +0000 (10:04 +0100)
commit3669a1af893088064778f14fba0c2ca88819e095
treeb8abf7be4f1fcfbd40ff2a4ffb02785e8b95552d
parente67ae1e27e27b0fce9974dbf1b5bc6adff27a213
net/virtio: fix memory leak when reinitializing device

Free the previous queues and the attached mbufs before initializing new
ones.

The function virtio_dev_free_mbufs() is now called when reconfiguring the
device, so we also need to add a check to ensure that it won't crash for
uninitialized queues.

Cc: stable@dpdk.org
Fixes: 60e6f4707ef2 ("net/virtio: reinitialize device when configuring")

Signed-off-by: Zijie Pan <zijie.pan@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Yuanhan Liu <yliu@fridaylinux.org>
drivers/net/virtio/virtio_ethdev.c