Page MenuHomeFreeBSD

[unix(4) cleanup 4/8] Simplify unp_disconnect() callers.
ClosedPublic

Authored by markj on Sep 2 2020, 4:56 PM.
Tags
None
Referenced Files
F166659593: D26297.id76668.diff
Sat, Aug 15, 7:33 AM
F166589778: D26297.diff
Fri, Aug 14, 6:46 PM
Unknown Object (File)
Fri, Aug 14, 2:17 AM
Unknown Object (File)
Thu, Aug 13, 8:50 PM
Unknown Object (File)
Thu, Aug 13, 12:13 PM
Unknown Object (File)
Thu, Aug 13, 7:04 AM
Unknown Object (File)
Wed, Aug 12, 10:17 PM
Unknown Object (File)
Tue, Aug 11, 11:53 PM
Subscribers

Details

Summary

In all cases, PCBs are unlocked after unp_disconnect() returns. Since
unp_disconnect() may release the last PCB reference, callers may have to
bump the refcount before the call just so that they can release them
again.

Change unp_disconnect() to release PCB locks as well as connection
references. Remove code that bumps and then releases the refcount.
Tighten assertions.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Sep 2 2020, 4:56 PM
markj created this revision.

Use unp_pcb_unlock_pair().

sys/kern/uipc_usrreq.c
2003 ↗(On Diff #76550)

There is a bug here, fixed later in the series: if unp_conn == NULL we might in fact be dropping the last reference here.

Don't use unp_pcb_rele_notlast() when we may in fact be releasing the last ref.

This revision was not accepted when it landed; it landed in state Needs Review.Sep 15 2020, 7:22 PM
This revision was automatically updated to reflect the committed changes.