Previously error codes from group_get_lru() were ignored, possibly
causing NULL pointer dereferencing. This patch appropriately checks for
errors.

Fixes: 4a95091d1f66 ("lib: Add IGMP snooping library bits")
Signed-off-by: Mike Pattrick <m...@redhat.com>
---
 lib/mcast-snooping.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/mcast-snooping.c b/lib/mcast-snooping.c
index dc5164b41..bf25e6f20 100644
--- a/lib/mcast-snooping.c
+++ b/lib/mcast-snooping.c
@@ -432,7 +432,9 @@ mcast_snooping_add_group(struct mcast_snooping *ms,
         uint32_t hash = mcast_table_hash(ms, addr, vlan);
 
         if (hmap_count(&ms->table) >= ms->max_entries) {
-            group_get_lru(ms, &grp);
+            if (!group_get_lru(ms, &grp)) {
+                return false;
+            }
             mcast_snooping_flush_group(ms, grp);
         }
 
-- 
2.43.5

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to