DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chenbo Xia <chenbo.xia@intel.com>
To: dev@dpdk.org
Cc: maxime.coquelin@redhat.com, zhihong.wang@intel.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v1] net/virtio-user: fix return value check
Date: Wed, 29 Jul 2020 13:12:30 +0000	[thread overview]
Message-ID: <20200729131230.14847-1-chenbo.xia@intel.com> (raw)

Setting the flags of tapfd may fail and the return value
should be checked.

Coverity issue: 140739
Fixes: e3b434818bbb ("net/virtio-user: support kernel vhost")
Cc: stable@dpdk.org

Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
---
 drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
index 2fa4f0d66..acddefa33 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
@@ -128,7 +128,10 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq,
 		goto error;
 	}
 
-	fcntl(tapfd, F_SETFL, O_NONBLOCK);
+	if (fcntl(tapfd, F_SETFL, O_NONBLOCK) < 0) {
+		PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", strerror(errno));
+		goto error;
+	}
 
 	if (ioctl(tapfd, TUNSETVNETHDRSZ, &hdr_size) < 0) {
 		PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", strerror(errno));
-- 
2.17.1


             reply	other threads:[~2020-07-29  4:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29 13:12 Chenbo Xia [this message]
2020-07-29 14:22 ` Maxime Coquelin
2020-07-29 14:54 ` Maxime Coquelin
  -- strict thread matches above, loose matches on Subject: below --
2019-04-10  2:44 Chenbo Xia
2019-04-10  2:44 ` Chenbo Xia
2019-04-10  4:37 ` Rami Rosen
2019-04-10  4:37   ` Rami Rosen
2019-04-10 15:18 ` Jens Freimann
2019-04-10 15:18   ` Jens Freimann
2019-04-12  4:16 ` Tiwei Bie
2019-04-12  4:16   ` Tiwei Bie
2019-04-17  7:56 ` Maxime Coquelin
2019-04-17  7:56   ` Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200729131230.14847-1-chenbo.xia@intel.com \
    --to=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=zhihong.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).