net/virtio-user: fix error run close(0)
Checks
Commit Message
From: Jiawei Zhu <zhujiawei12@huawei.com>
When i < VIRTIO_MAX_VIRTQUEUES and j == i,
dev->callfds[i] and dev->kickfds[i] are default 0.
So it will close(0), close the standard input (stdin).
Fixes: e6e7ad8b3024 ("net/virtio-user: move eventfd open/close into init/uninit")
Cc: stable@dpdk.org
Signed-off-by: Jiawei Zhu <zhujiawei12@huawei.com>
---
drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -284,7 +284,7 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)
}
if (i < VIRTIO_MAX_VIRTQUEUES) {
- for (j = 0; j <= i; ++j) {
+ for (j = 0; j < i; ++j) {
close(dev->callfds[j]);
close(dev->kickfds[j]);
}