DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tomasz Kulasek <tomaszx.kulasek@intel.com>
To: yliu@fridaylinux.org
Cc: dev@dpdk.org, jianfeng.tan@intel.com, stable@dpdk.org,
	Pawel Wodkowski <pawelx.wodkowski@intel.com>
Subject: [dpdk-dev] [PATCH v2] vhost: fix check if cmsg is NULL
Date: Fri,  9 Feb 2018 18:05:45 +0100	[thread overview]
Message-ID: <20180209170545.7428-1-tomaszx.kulasek@intel.com> (raw)
In-Reply-To: <20180208170322.52568-1-tomaszx.kulasek@intel.com>

Fixes: 8f972312b8f4 ("vhost: support vhost-user")
Cc: jianfeng.tan@intel.com
Cc: stable@dpdk.org

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
---
v2 changes:
  - Changed fixline to point right commit

---
 lib/librte_vhost/socket.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index 83befdced..8fd47a4d8 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -153,6 +153,11 @@ send_fd_message(int sockfd, char *buf, int buflen, int *fds, int fd_num)
 		msgh.msg_control = control;
 		msgh.msg_controllen = sizeof(control);
 		cmsg = CMSG_FIRSTHDR(&msgh);
+		if (cmsg == NULL) {
+			RTE_LOG(ERR, VHOST_CONFIG, "cmsg == NULL\n");
+			errno = EINVAL;
+			return -1;
+		}
 		cmsg->cmsg_len = CMSG_LEN(fdsize);
 		cmsg->cmsg_level = SOL_SOCKET;
 		cmsg->cmsg_type = SCM_RIGHTS;
-- 
2.14.1

  parent reply	other threads:[~2018-02-09 17:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 17:03 [dpdk-dev] [PATCH] " Tomasz Kulasek
2018-02-09  1:51 ` Tan, Jianfeng
2018-02-09 17:05 ` Tomasz Kulasek [this message]
2018-02-11  1:06   ` [dpdk-dev] [PATCH v2] " Tan, Jianfeng
2018-02-20  9:03   ` 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=20180209170545.7428-1-tomaszx.kulasek@intel.com \
    --to=tomaszx.kulasek@intel.com \
    --cc=dev@dpdk.org \
    --cc=jianfeng.tan@intel.com \
    --cc=pawelx.wodkowski@intel.com \
    --cc=stable@dpdk.org \
    --cc=yliu@fridaylinux.org \
    /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).