Avoid dereferencing potentially freed workitem in
authorkib <kib@FreeBSD.org>
Mon, 21 Aug 2017 16:23:44 +0000 (16:23 +0000)
committerkib <kib@FreeBSD.org>
Mon, 21 Aug 2017 16:23:44 +0000 (16:23 +0000)
commit3149ed68c4c491558c8d6797349ea3096325f183
treed13cbc6a5d49e93c7f1a25539a71c6ccf7d7048d
parent77de7ac78ae401d991100e6b21ae943a9f1f79e1
Avoid dereferencing potentially freed workitem in
softdep_count_dependencies().

Buffer's b_dep list is protected by the SU mount lock.  Owning the
buffer lock is not enough to guarantee the stability of the list.

Calculation of the UFS mount owning the workitems from the buffer must
be much more careful to not dereference the work item which might be
freed meantime.  To get to ump, use the pointers chain which does not
involve workitems at all.

Reported and tested by: pho
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
sys/ufs/ffs/ffs_softdep.c