DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: fix check if cmsg is NULL
@ 2018-02-08 17:03 Tomasz Kulasek
  2018-02-09  1:51 ` Tan, Jianfeng
  2018-02-09 17:05 ` [dpdk-dev] [PATCH v2] " Tomasz Kulasek
  0 siblings, 2 replies; 5+ messages in thread
From: Tomasz Kulasek @ 2018-02-08 17:03 UTC (permalink / raw)
  To: yliu; +Cc: dev, jianfeng.tan, stable, Pawel Wodkowski

Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")
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>
---
 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: fix check if cmsg is NULL
  2018-02-08 17:03 [dpdk-dev] [PATCH] vhost: fix check if cmsg is NULL Tomasz Kulasek
@ 2018-02-09  1:51 ` Tan, Jianfeng
  2018-02-09 17:05 ` [dpdk-dev] [PATCH v2] " Tomasz Kulasek
  1 sibling, 0 replies; 5+ messages in thread
From: Tan, Jianfeng @ 2018-02-09  1:51 UTC (permalink / raw)
  To: Kulasek, TomaszX, yliu; +Cc: dev, stable, Wodkowski, PawelX

Hi Tomasz,

> -----Original Message-----
> From: Kulasek, TomaszX
> Sent: Friday, February 9, 2018 1:03 AM
> To: yliu@fridaylinux.org
> Cc: dev@dpdk.org; Tan, Jianfeng; stable@dpdk.org; Wodkowski, PawelX
> Subject: [PATCH] vhost: fix check if cmsg is NULL
> 
> Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")

Firstly, this fix line is incorrect. It shall be:

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>
> ---
>  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);

I suppose it will not return NULL as the control is defined as a variable-length array. But no harm to check it.

Thanks,
Jianfeng

> +		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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v2] vhost: fix check if cmsg is NULL
  2018-02-08 17:03 [dpdk-dev] [PATCH] vhost: fix check if cmsg is NULL Tomasz Kulasek
  2018-02-09  1:51 ` Tan, Jianfeng
@ 2018-02-09 17:05 ` Tomasz Kulasek
  2018-02-11  1:06   ` Tan, Jianfeng
  2018-02-20  9:03   ` Maxime Coquelin
  1 sibling, 2 replies; 5+ messages in thread
From: Tomasz Kulasek @ 2018-02-09 17:05 UTC (permalink / raw)
  To: yliu; +Cc: dev, jianfeng.tan, stable, Pawel Wodkowski

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] vhost: fix check if cmsg is NULL
  2018-02-09 17:05 ` [dpdk-dev] [PATCH v2] " Tomasz Kulasek
@ 2018-02-11  1:06   ` Tan, Jianfeng
  2018-02-20  9:03   ` Maxime Coquelin
  1 sibling, 0 replies; 5+ messages in thread
From: Tan, Jianfeng @ 2018-02-11  1:06 UTC (permalink / raw)
  To: Kulasek, TomaszX, yliu; +Cc: dev, stable, Wodkowski, PawelX



> -----Original Message-----
> From: Kulasek, TomaszX
> Sent: Saturday, February 10, 2018 1:06 AM
> To: yliu@fridaylinux.org
> Cc: dev@dpdk.org; Tan, Jianfeng; stable@dpdk.org; Wodkowski, PawelX
> Subject: [PATCH v2] vhost: fix check if cmsg is NULL
> 
> 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>
Reviewed-by: Jianfeng Tan <jianfeng.tan@intel.com>

Thanks for the fix.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] vhost: fix check if cmsg is NULL
  2018-02-09 17:05 ` [dpdk-dev] [PATCH v2] " Tomasz Kulasek
  2018-02-11  1:06   ` Tan, Jianfeng
@ 2018-02-20  9:03   ` Maxime Coquelin
  1 sibling, 0 replies; 5+ messages in thread
From: Maxime Coquelin @ 2018-02-20  9:03 UTC (permalink / raw)
  To: Tomasz Kulasek, yliu; +Cc: dev, jianfeng.tan, stable, Pawel Wodkowski

Hi Tomasz,

On 02/09/2018 06:05 PM, Tomasz Kulasek wrote:
> 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(+)

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

and applied to dpdk-next-virtio/master.

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-20  9:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08 17:03 [dpdk-dev] [PATCH] vhost: fix check if cmsg is NULL Tomasz Kulasek
2018-02-09  1:51 ` Tan, Jianfeng
2018-02-09 17:05 ` [dpdk-dev] [PATCH v2] " Tomasz Kulasek
2018-02-11  1:06   ` Tan, Jianfeng
2018-02-20  9:03   ` Maxime Coquelin

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).