]> git.ipfire.org Git - thirdparty/libvirt.git/commit
nodedev: Lock @priv sooner
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 12 Apr 2021 14:20:57 +0000 (16:20 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 13 Apr 2021 07:33:15 +0000 (09:33 +0200)
commit3d3435e39510412604b7427285497a4e5e39cad5
tree325900ab56d2dac3d2eaba4b9da560e2d557acf9
parent9cfcc296fe641ee5d5c7e7802b1df40dd3749944
nodedev: Lock @priv sooner

The nodedev driver private data object @priv is created by
calling udevEventDataNew(). After that, driver->privateData
pointer is set to the freshly allocated object and only a few
lines after all of this the object is locked. Technically it is
safe because there should not be any other thread at this point,
but defensive style of programming says it's better if the object
is locked before driver's privateData is set.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/node_device/node_device_udev.c