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

            Bug ID: 255866
           Summary: [PATCH] dev/ocs_fc: Fix a use after free in
                    ocs_sport_free
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 224930
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=224930&action=edit
add a new variable ocs

Bug File: sys/dev/ocs_fc/ocs_sport.c

In function ocs_sport_free, domain could be freed via
ocs_domain_post_event(domain,..)->ocs_domain_free(domain)->ocs_free(ocs,
domain, sizeof(*domain)). 

But the freed domain is still used by domain->ocs at line 266 via
ocs_free(domain->ocs, sport, sizeof(*sport)).

My patch adds a new variable ocs and sets ocs =domain->ocs before domain can be
free, to avoid the uaf bug.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to