diff mbox series

[ovs-dev,7/8] mcast-snooping: Properly check return code from group_get_lru

Message ID 20240820131444.1724438-8-mkp@redhat.com
State Superseded, archived
Headers show
Series Address clang analyze warnings. | expand

Checks

Context Check Description
ovsrobot/apply-robot warning apply and check: warning
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Mike Pattrick Aug. 20, 2024, 1:14 p.m. UTC
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 <mkp@redhat.com>
---
 lib/mcast-snooping.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Simon Horman Aug. 28, 2024, 10:50 a.m. UTC | #1
On Tue, Aug 20, 2024 at 09:14:43AM -0400, Mike Pattrick wrote:
> 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 <mkp@redhat.com>

Acked-by: Simon Horman <horms@ovn.org>
diff mbox series

Patch

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);
         }