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

Liviu Chircu noreply at github.com
Thu Oct 17 05:43:21 EDT 2019


  Branch: refs/heads/3.0
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 8f6188e5cf547eb94987e11051895e84abffe14a
      https://github.com/OpenSIPS/opensips/commit/8f6188e5cf547eb94987e11051895e84abffe14a
  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"

(cherry picked from commit 0db946724e9eaa364f54425f8664d96529e848a1)





More information about the Devel mailing list