[OpenSIPS-Devel] [OpenSIPS/opensips] 0db946: struct hist API: Fix possible crashes; Improve API

Liviu Chircu noreply at github.com
Thu Oct 17 05:42:26 EDT 2019


  Branch: refs/heads/2.4
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 0db946724e9eaa364f54425f8664d96529e848a1
      https://github.com/OpenSIPS/opensips/commit/0db946724e9eaa364f54425f8664d96529e848a1
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2019-10-17 (Thu, 17 Oct 2019)

  Changed paths:
    M lib/dbg/struct_hist.c
    M lib/dbg/struct_hist.h
    M net/net_tcp.c

  Log Message:
  -----------
  struct hist API:  Fix possible crashes; Improve API

Commit a74fff149a introduced a race condition on this logic:

    lock_get(&sh->shlist->wlock);
    sh_unref_unsafe(sh);
    lock_release(&sh->shlist->wlock);

, where "sh" must no longer be read following the unref operation.
This commit fixes this issue, along with:

    * fix crash with -DSTRUCT_HIST but no -DDBG_TCPCON
    * speed optimizations: eliminate memset() operations (not needed)
    * make sh_push() more flexible (extra ref counts from outside)
    * code: hide structs, so importing struct_hist.h doesn't conflict
       with mysql.h's own "struct list_head"





More information about the Devel mailing list