* [PATCH] vhost: fix unchecked return value
@ 2017-09-22 12:17 Kuba Kozak
2017-10-02 14:18 ` Jastrzebski, MichalX K
2017-10-09 3:10 ` Yuanhan Liu
0 siblings, 2 replies; 5+ messages in thread
From: Kuba Kozak @ 2017-09-22 12:17 UTC (permalink / raw)
To: yliu, maxime.coquelin; +Cc: dev, Kuba Kozak, jan.wickbom, stable
Add return value check for poll() call.
Coverity issue: 140740
Fixes: 59317cef249c ("vhost: allow many vhost-user ports")
Cc: jan.wickbom@ericsson.com
Cc: stable@dpdk.org
Signed-off-by: Kuba Kozak <kubax.kozak@intel.com>
---
lib/librte_vhost/fd_man.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/librte_vhost/fd_man.c b/lib/librte_vhost/fd_man.c
index 2ceacc9..4c6fed4 100644
--- a/lib/librte_vhost/fd_man.c
+++ b/lib/librte_vhost/fd_man.c
@@ -222,6 +222,7 @@ fdset_event_dispatch(void *arg)
int remove1, remove2;
int need_shrink;
struct fdset *pfdset = arg;
+ int val;
if (pfdset == NULL)
return NULL;
@@ -239,7 +240,9 @@ fdset_event_dispatch(void *arg)
numfds = pfdset->num;
pthread_mutex_unlock(&pfdset->fd_mutex);
- poll(pfdset->rwfds, numfds, 1000 /* millisecs */);
+ val = poll(pfdset->rwfds, numfds, 1000 /* millisecs */);
+ if (val < 0)
+ continue;
need_shrink = 0;
for (i = 0; i < numfds; i++) {
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] vhost: fix unchecked return value
2017-09-22 12:17 [PATCH] vhost: fix unchecked return value Kuba Kozak
@ 2017-10-02 14:18 ` Jastrzebski, MichalX K
2017-10-09 3:10 ` Yuanhan Liu
1 sibling, 0 replies; 5+ messages in thread
From: Jastrzebski, MichalX K @ 2017-10-02 14:18 UTC (permalink / raw)
To: Kozak, KubaX, yliu, maxime.coquelin
Cc: dev, Kozak, KubaX, jan.wickbom, stable
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Kuba Kozak
> Sent: Friday, September 22, 2017 2:18 PM
> To: yliu@fridaylinux.org; maxime.coquelin@redhat.com
> Cc: dev@dpdk.org; Kozak, KubaX <kubax.kozak@intel.com>;
> jan.wickbom@ericsson.com; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] vhost: fix unchecked return value
>
> Add return value check for poll() call.
>
> Coverity issue: 140740
> Fixes: 59317cef249c ("vhost: allow many vhost-user ports")
> Cc: jan.wickbom@ericsson.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Kuba Kozak <kubax.kozak@intel.com>
> ---
> lib/librte_vhost/fd_man.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_vhost/fd_man.c b/lib/librte_vhost/fd_man.c
> index 2ceacc9..4c6fed4 100644
> --- a/lib/librte_vhost/fd_man.c
> +++ b/lib/librte_vhost/fd_man.c
> @@ -222,6 +222,7 @@ fdset_event_dispatch(void *arg)
> int remove1, remove2;
> int need_shrink;
> struct fdset *pfdset = arg;
> + int val;
>
> if (pfdset == NULL)
> return NULL;
> @@ -239,7 +240,9 @@ fdset_event_dispatch(void *arg)
> numfds = pfdset->num;
> pthread_mutex_unlock(&pfdset->fd_mutex);
>
> - poll(pfdset->rwfds, numfds, 1000 /* millisecs */);
> + val = poll(pfdset->rwfds, numfds, 1000 /* millisecs */);
> + if (val < 0)
> + continue;
>
> need_shrink = 0;
> for (i = 0; i < numfds; i++) {
> --
> 2.7.4
Hi Yu / Maxime,
I would like to ask for a feedback regarding proposed fix.
If everything is ok with it, please send acked-by.
Best regards
Michal.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] vhost: fix unchecked return value
2017-09-22 12:17 [PATCH] vhost: fix unchecked return value Kuba Kozak
2017-10-02 14:18 ` Jastrzebski, MichalX K
@ 2017-10-09 3:10 ` Yuanhan Liu
1 sibling, 0 replies; 5+ messages in thread
From: Yuanhan Liu @ 2017-10-09 3:10 UTC (permalink / raw)
To: Kuba Kozak; +Cc: maxime.coquelin, dev, jan.wickbom, stable
On Fri, Sep 22, 2017 at 02:17:40PM +0200, Kuba Kozak wrote:
> Add return value check for poll() call.
>
> Coverity issue: 140740
> Fixes: 59317cef249c ("vhost: allow many vhost-user ports")
> Cc: jan.wickbom@ericsson.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Kuba Kozak <kubax.kozak@intel.com>
Applied to dpdk-next-virtio.
Thanks.
--yliu
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] vhost: fix unchecked return value
2022-06-23 1:08 Jiayu Hu
@ 2022-06-23 2:44 ` Xia, Chenbo
0 siblings, 0 replies; 5+ messages in thread
From: Xia, Chenbo @ 2022-06-23 2:44 UTC (permalink / raw)
To: Hu, Jiayu, dev; +Cc: maxime.coquelin
Hi Jiayu,
> -----Original Message-----
> From: Hu, Jiayu <jiayu.hu@intel.com>
> Sent: Thursday, June 23, 2022 9:09 AM
> To: dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>; Hu,
> Jiayu <jiayu.hu@intel.com>
> Subject: [PATCH] vhost: fix unchecked return value
>
> This patch checks the return value of rte_dma_info_get()
> called in rte_vhost_async_dma_configure().
>
> Coverity issue: 379066
> Fixes: 53d3f4778c1d ("vhost: integrate dmadev in asynchronous data-path")
Missed CC stable tag
With this fixed:
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
>
> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> ---
> lib/vhost/vhost.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
> index b14521e4d1..70c04c036e 100644
> --- a/lib/vhost/vhost.c
> +++ b/lib/vhost/vhost.c
> @@ -1868,7 +1868,11 @@ rte_vhost_async_dma_configure(int16_t dma_id,
> uint16_t vchan_id)
> return -1;
> }
>
> - rte_dma_info_get(dma_id, &info);
> + if (rte_dma_info_get(dma_id, &info) != 0) {
> + VHOST_LOG_CONFIG(ERR, "Fail to get DMA %d information.\n",
> dma_id);
> + return -1;
> + }
> +
> if (vchan_id >= info.max_vchans) {
> VHOST_LOG_CONFIG(ERR, "Invalid DMA %d vChannel %u.\n", dma_id,
> vchan_id);
> return -1;
> --
> 2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] vhost: fix unchecked return value
@ 2022-06-23 1:08 Jiayu Hu
2022-06-23 2:44 ` Xia, Chenbo
0 siblings, 1 reply; 5+ messages in thread
From: Jiayu Hu @ 2022-06-23 1:08 UTC (permalink / raw)
To: dev; +Cc: maxime.coquelin, chenbo.xia, Jiayu Hu
This patch checks the return value of rte_dma_info_get()
called in rte_vhost_async_dma_configure().
Coverity issue: 379066
Fixes: 53d3f4778c1d ("vhost: integrate dmadev in asynchronous data-path")
Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
---
lib/vhost/vhost.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
index b14521e4d1..70c04c036e 100644
--- a/lib/vhost/vhost.c
+++ b/lib/vhost/vhost.c
@@ -1868,7 +1868,11 @@ rte_vhost_async_dma_configure(int16_t dma_id, uint16_t vchan_id)
return -1;
}
- rte_dma_info_get(dma_id, &info);
+ if (rte_dma_info_get(dma_id, &info) != 0) {
+ VHOST_LOG_CONFIG(ERR, "Fail to get DMA %d information.\n", dma_id);
+ return -1;
+ }
+
if (vchan_id >= info.max_vchans) {
VHOST_LOG_CONFIG(ERR, "Invalid DMA %d vChannel %u.\n", dma_id, vchan_id);
return -1;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-06-23 2:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-22 12:17 [PATCH] vhost: fix unchecked return value Kuba Kozak
2017-10-02 14:18 ` Jastrzebski, MichalX K
2017-10-09 3:10 ` Yuanhan Liu
2022-06-23 1:08 Jiayu Hu
2022-06-23 2:44 ` Xia, Chenbo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.