* Re: [dpdk-dev] [PATCH 1/1] vhost: fix null pointer dereference
2016-06-15 9:47 [dpdk-dev] [PATCH 1/1] vhost: fix null pointer dereference Marcin Kerlin
@ 2016-06-15 9:01 ` Yuanhan Liu
0 siblings, 0 replies; 2+ messages in thread
From: Yuanhan Liu @ 2016-06-15 9:01 UTC (permalink / raw)
To: Marcin Kerlin; +Cc: huawei.xie, dev, Mcnamara, John
On Wed, Jun 15, 2016 at 11:47:22AM +0200, Marcin Kerlin wrote:
> Return value of function get_device() is not checking before
> dereference. Fix this problem by adding checking condition.
>
> Coverity issue: 119262
> Fixes: 77d20126b4c2 ("vhost-user: handle message to enable vring")
>
> Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
Applied to dpdk-next-virtio.
Thanks.
--yliu
^ permalink raw reply [flat|nested] 2+ messages in thread
* [dpdk-dev] [PATCH 1/1] vhost: fix null pointer dereference
@ 2016-06-15 9:47 Marcin Kerlin
2016-06-15 9:01 ` Yuanhan Liu
0 siblings, 1 reply; 2+ messages in thread
From: Marcin Kerlin @ 2016-06-15 9:47 UTC (permalink / raw)
To: changchun.ouyang; +Cc: huawei.xie, yuanhan.liu, dev, Marcin Kerlin
Return value of function get_device() is not checking before
dereference. Fix this problem by adding checking condition.
Coverity issue: 119262
Fixes: 77d20126b4c2 ("vhost-user: handle message to enable vring")
Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
---
lib/librte_vhost/vhost_user/virtio-net-user.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vhost/vhost_user/virtio-net-user.c
index f5248bc..94959f2 100644
--- a/lib/librte_vhost/vhost_user/virtio-net-user.c
+++ b/lib/librte_vhost/vhost_user/virtio-net-user.c
@@ -332,9 +332,13 @@ int
user_set_vring_enable(struct vhost_device_ctx ctx,
struct vhost_vring_state *state)
{
- struct virtio_net *dev = get_device(ctx);
+ struct virtio_net *dev;
int enable = (int)state->num;
+ dev = get_device(ctx);
+ if (dev == NULL)
+ return -1;
+
RTE_LOG(INFO, VHOST_CONFIG,
"set queue enable: %d to qp idx: %d\n",
enable, state->index);
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-15 9:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15 9:47 [dpdk-dev] [PATCH 1/1] vhost: fix null pointer dereference Marcin Kerlin
2016-06-15 9:01 ` Yuanhan Liu
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).