From: Sebastian Basierski Date: Tue, 14 Nov 2017 10:39:56 +0000 (+0100) Subject: net/virtio-user: check error on clearing non block flag X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f76ef453320c972ebb3aa68cb0f3b989879b1077;p=dpdk.git net/virtio-user: check error on clearing non block flag Report error message if clearing O_NONBLOCK flag will fail, 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: Maxime Coquelin --- diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 452cdfc88b..2636490063 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -80,7 +80,11 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, } else { dev->status |= VIRTIO_NET_S_LINK_UP; } - fcntl(dev->vhostfd, F_SETFL, flags & (~O_NONBLOCK)); + if (fcntl(dev->vhostfd, F_SETFL, + flags & ~O_NONBLOCK) == -1) { + PMD_DRV_LOG(ERR, "error clearing O_NONBLOCK flag"); + return; + } } *(uint16_t *)dst = dev->status; }