]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Do not leak mount references for dying threads.
authorKonstantin Belousov <kib@FreeBSD.org>
Sat, 25 Feb 2017 10:38:18 +0000 (10:38 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Sat, 25 Feb 2017 10:38:18 +0000 (10:38 +0000)
commitaca4bb9112dc98fe2777ef71ebcef4b0e5c75cff
tree60374cd37d42676571da6c54d01972ee15dea71a
parentd360b49b1dd52310cc750f86e0c793f3b51f6023
Do not leak mount references for dying threads.

Thread might create a condition for delayed SU cleanup, which creates
a reference to the mount point in td_su, but exit without returning
through userret(), e.g. when terminating due to single-threading or
process exit.  In this case, td_su reference is not dropped and mount
point cannot be freed.

Handle the situation by clearing td_su also in the thread destructor
and in exit1().  softdep_ast_cleanup() has to receive the thread as
argument, since e.g. thread destructor is executed in different
context.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
sys/fs/nfsserver/nfs_nfsdkrpc.c
sys/kern/kern_exit.c
sys/kern/kern_thread.c
sys/kern/subr_trap.c
sys/sys/proc.h
sys/sys/systm.h
sys/ufs/ffs/ffs_softdep.c