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: ef53b60300
("net/virtio-user: support LSC")
Cc: stable@dpdk.org
Signed-off-by: Sebastian Basierski <sebastianx.basierski@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yliu@fridaylinux.org>
This commit is contained in:
parent
3a643acd4f
commit
2fd826a301
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user