diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index 824144bb7774..fbb6ddbb7f89 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -3058,18 +3058,19 @@ vxlan_fdb_flush_match_remotes(struct vxlan_fdb *f, struct vxlan_dev *vxlan, const struct vxlan_fdb_flush_desc *desc, bool *p_destroy_fdb) { - bool remotes_flushed = false; struct vxlan_rdst *rd, *tmp; list_for_each_entry_safe(rd, tmp, &f->remotes, list) { if (!vxlan_fdb_flush_remote_matches(desc, rd)) continue; - vxlan_fdb_dst_destroy(vxlan, f, rd, true); - remotes_flushed = true; - } + if (list_is_singular(&f->remotes)) { + *p_destroy_fdb = true; + return; + } - *p_destroy_fdb = remotes_flushed && list_empty(&f->remotes); + vxlan_fdb_dst_destroy(vxlan, f, rd, true); + } } /* Purge the forwarding table */