[Bug 137145] [mbuf] Reference count computing isn't correct when more than one threads call function m_copypacket
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
 
Date: Sat, 15 Mar 2025 01:48:11 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=137145
Zhenlei Huang <zlei@FreeBSD.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |glebius@FreeBSD.org,
                   |                            |zlei@FreeBSD.org
--- Comment #8 from Zhenlei Huang <zlei@FreeBSD.org> ---
Gleb changed some logic of mb_dupcl(), the patch should be rebased. I think we
still risk concurrent mb_dupcl().
```
         /* See if this is the mbuf that holds the embedded refcount. */
         if (m->m_ext.ext_flags & EXT_FLAG_EMBREF) {
                 refcnt = n->m_ext.ext_cnt = &m->m_ext.ext_count;
                 n->m_ext.ext_flags &= ~EXT_FLAG_EMBREF;
         } else {
                 KASSERT(m->m_ext.ext_cnt != NULL,
                     ("%s: no refcounting pointer on %p", __func__, m));
                 refcnt = m->m_ext.ext_cnt;
         }
         if (*refcnt == 1)
                 *refcnt += 1; /* XXX_ZL possible to lose update on concurrent
mb_dupcl() */
         else
                 atomic_add_int(refcnt, 1);
```
also CC @Gleb
-- 
You are receiving this mail because:
You are the assignee for the bug.