mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
nwfilter: fix crash when adding non-existing nwfilter
Adding non-existing nwfilter to a network interface device without any nwfilter specified will crash libvirt daemon with segfault. The reason is that the nwfilter is not found an libvirt will try to restore old nwfilter configuration but there is no nwfilter specified. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
82bde4261d
commit
d98ad8dd0c
@ -2778,7 +2778,7 @@ virNWFilterObjFindByName(virNWFilterObjListPtr nwfilters, const char *name)
|
|||||||
|
|
||||||
for (i = 0; i < nwfilters->count; i++) {
|
for (i = 0; i < nwfilters->count; i++) {
|
||||||
virNWFilterObjLock(nwfilters->objs[i]);
|
virNWFilterObjLock(nwfilters->objs[i]);
|
||||||
if (STREQ(nwfilters->objs[i]->def->name, name))
|
if (STREQ_NULLABLE(nwfilters->objs[i]->def->name, name))
|
||||||
return nwfilters->objs[i];
|
return nwfilters->objs[i];
|
||||||
virNWFilterObjUnlock(nwfilters->objs[i]);
|
virNWFilterObjUnlock(nwfilters->objs[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user