From: Sebastian Basierski Date: Tue, 24 Oct 2017 08:17:38 +0000 (+0200) Subject: net/virtio: check error on setting non block flag X-Git-Tag: spdx-start~1244 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2fd826a301b5a872cad0b67c807d3011693321c7;p=dpdk.git net/virtio: check error on setting non block flag Report an error message if the flag O_NONBLOCK setting fails, then return from function. Coverity issue: 143439 Fixes: ef53b6030039 ("net/virtio-user: support LSC") Cc: stable@dpdk.org Signed-off-by: Sebastian Basierski Acked-by: Jianfeng Tan Acked-by: Yuanhan Liu --- diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 57c964d6d8..20b72922a1 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -86,7 +86,11 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, int flags; flags = fcntl(dev->vhostfd, F_GETFL); - fcntl(dev->vhostfd, F_SETFL, flags | O_NONBLOCK); + if (fcntl(dev->vhostfd, F_SETFL, + flags | O_NONBLOCK) == -1) { + PMD_DRV_LOG(ERR, "error setting O_NONBLOCK flag"); + return; + } r = recv(dev->vhostfd, buf, 128, MSG_PEEK); if (r == 0 || (r < 0 && errno != EAGAIN)) { dev->status &= (~VIRTIO_NET_S_LINK_UP);