mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
cuse: Assert the server refcount
Assert that the refcount does not underflow before decrementing it, and that it really is zero by the time the server is freed. MFC after: 1 week Sponsored by: The FreeBSD Foundation Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D60043
This commit is contained in:
1 parent
d38ef1aca9
commit
f96c4f45f7
1 file changed
+2
@@ -648,6 +648,7 @@ cuse_server_unref(struct cuse_server *pcs)
|
||||
*/
|
||||
cuse_global_lock();
|
||||
cuse_server_lock(pcs);
|
||||
MPASS(pcs->refs > 0);
|
||||
if (--(pcs->refs) != 0) {
|
||||
cuse_server_unlock(pcs);
|
||||
cuse_global_unlock();
|
||||
@@ -683,6 +684,7 @@ cuse_server_unref(struct cuse_server *pcs)
|
||||
|
||||
mtx_destroy(&pcs->mtx);
|
||||
|
||||
MPASS(pcs->refs == 0);
|
||||
free(pcs, M_CUSE);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user