]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
When the smbfs iod thread (smb_iod_thread()) is shutting down, smb_iod_destroy()
authorrmacklem <rmacklem@FreeBSD.org>
Mon, 16 Nov 2015 23:19:53 +0000 (23:19 +0000)
committerrmacklem <rmacklem@FreeBSD.org>
Mon, 16 Nov 2015 23:19:53 +0000 (23:19 +0000)
commitee4d679462a6b1e60783fe6f0057684a40862ffa
tree5bc6e87a7d1e8ccb9bb7bb172685fa6b66763148
parent7965ca51f7d36e891e8674e4c27e473ed291f287
When the smbfs iod thread (smb_iod_thread()) is shutting down, smb_iod_destroy()
would call smb_iod_request(). This call could return as soon as the
wakeup(evp) in smb_iod_main() call is done and then could destroy
the mutexes. This caused a race with the rest of smb_iod_main()s
use of these mutexes.
A crash reported on freebsd-stable@ by Christian Kratzer was
diagnosed as a use of one of these mutexes after it was destroyed.
This patch moves destruction of the mutexes from smb_iod_destroy()
to the end of smb_iod_thread(), so that they aren't destroyed before
the thread is done with them. Christian comfirmed that the patch
stopped the crashes from happening.

Reported by: ck-lists@cksoft.de (Christian Kratzer)
Tested by: ck-lists@cksoft.de (Christian Kratzer)
Diagnosed by: jhb
Reviewed by: jhb
MFC after: 2 weeks
sys/netsmb/smb_iod.c