git: kdmsg: protect connection-state publication and ownership
Aaron LI
aly at crater.dragonflybsd.org
Thu Oct 22 07:23:36 PDT 2026
commit 7a91466016b04fe2d687c9113bfd1e8260d1a2cb
Author: David Bidner <david at crap.solutions>
Date: Tue Oct 20 05:42:45 2026 +0200
kdmsg: protect connection-state publication and ownership
Autoinitiate can create a connection transaction after the writer has
stopped. The state can survive into the next connection, where replacing
conn_state loses its held reference. An old close callback can also drop
the replacement state's reference instead of its own.
Hold msglk across creation, publication and queuing, and do not initiate
a connection once EXITNOACC is set. Use a locked allocator helper for
this call path so the allocator does not need recursive lock acquisition.
Release the previous conn_state reference before replacing it. On DELETE,
clear and release the slot only when it still points to the callback's
state, independently of whether a closing reply is needed.
Dropping the previous conn_state reference is now only needed when two
autoinitiates race on a live connection; otherwise the old transaction is
cleaned up through the state tree.
Bug: https://bugs.dragonflybsd.org/issues/3435
Summary of changes:
sys/kern/kern_dmsg.c | 64 +++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 48 insertions(+), 16 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/7a91466016b04fe2d687c9113bfd1e8260d1a2cb
--
DragonFly BSD source repository
More information about the Commits
mailing list