[Bug 261458] Fix a possible Null pointer dereference in igmp_domifattach()

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 25 Jan 2022 07:17:27 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261458

            Bug ID: 261458
           Summary: Fix a possible Null pointer dereference in
                    igmp_domifattach()
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: zhou1615@umn.edu

Created attachment 231298
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=231298&action=edit
A simple fix for this bug

In sys/netinet/igmp.c file, the return value of igi_alloc_locked() is assigned
to igi and there is a dereference of it right after that, which would lead to
NULL pointer dereference on failure of allocation.

Fix this bug by adding a NULL check of igi.

This bug is found by static analyzer, please advise.

-- 
You are receiving this mail because:
You are the assignee for the bug.