[Bug 255864] [PATCH] dev/core: Fix a double free in oce_tx

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri May 14 10:34:41 UTC 2021


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255864

            Bug ID: 255864
           Summary: [PATCH] dev/core: Fix a double free in oce_tx
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: lylgood at foxmail.com

Created attachment 224928
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=224928&action=edit
set *mpp to NULL

Bug File: sys/dev/oce/oce_if.c

In function oce_tx, it calls oce_tso_setup(..,mpp) at line 1,087.
Inside oce_tso_setup, m is assigned with *mpp, and then m is freed by the bad
branch of callee m_pullup() at line 1,332 and returns NULL. Now, *mpp points to
a freed memory object.

After oce_tso_setup() returns NULL, the execution comes to the free_ret branch
of oce_tx. Then, *mpp is freed again via m_freem() at line 1,229.

As m_pullup() returns NULL if *mpp is freed, my patch set *mpp to NULL by 
"*mpp = m" to avoid the double free.

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


More information about the freebsd-bugs mailing list