net/virtio: fix crash when device reconnecting
authorMarvin Liu <yong.liu@intel.com>
Wed, 6 May 2020 15:07:24 +0000 (23:07 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 11 May 2020 20:27:39 +0000 (22:27 +0200)
commit01996a034a78db79686238a9656f8a49367fe963
tree1485037d6ea68a5636e73934ddb7f11291cb7966
parent6b3042882060af2e5acbcf144baa58aa0af2cc14
net/virtio: fix crash when device reconnecting

When doing virtio device initialization, virtqueues will be reset in
server mode if ring type is packed. It will cause issue because queues
have been freed in the beginning of device initialization.

Fix this issue by checking whether device has been initialized before
reset. If device hasn't been initialized, there's no need to reset
queues.

Fixes: 6ebbf4109f35 ("net/virtio-user: fix packed ring server mode")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtio_user_ethdev.c