DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [BUG-REPORT] Need to add mutex on vhost_devices[] in virtio-net.c in DPDK-2.2?
@ 2017-10-12  6:29 Sam
  0 siblings, 0 replies; only message in thread
From: Sam @ 2017-10-12  6:29 UTC (permalink / raw)
  To: dev

Hi all,

I'm running vhostuser part code of dpdk, and I found a crash, which is
caused by call NULL pointer. Then I debug code and I found I use NULL
pointer which is got from vhost_devices[].

I read code of virtio-net.c, and I found there is no lock on
vhost_devices[] !!! vhost_devices[] is used
by vhost_destroy_device, get_device, vhost_new_device. If one thread use
get_device to get the dev pointer, and another thread use
vhost_destroy_device to destroy it, then crash will happen.

Also I know that, if one thread to call get_device or other functions, it
must supply vid, which means thread must hold vid itself, this mechanism
could solve the problem above. But now there is a requirement to dump all
info of dev in vhost_devices[] which is not NULL, so if there is no lock on
this array, crash will happens.

So how to fix this? And if this bug has already fixed in new version?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-10-12  6:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-12  6:29 [dpdk-dev] [BUG-REPORT] Need to add mutex on vhost_devices[] in virtio-net.c in DPDK-2.2? Sam

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