]> git.michaelhowe.org Git - packages/o/openafs.git/commit
libafscp: Can't unlock something we've freed
authorSimon Wilkinson <sxw@your-file-system.com>
Wed, 27 Feb 2013 10:11:21 +0000 (10:11 +0000)
committerJeffrey Altman <jaltman@your-file-system.com>
Wed, 27 Feb 2013 20:43:59 +0000 (12:43 -0800)
commitce20f1f15103226667bc872378cf9b2e4b3e8cd7
treef6937679332169d06cc0d10ee6a2391796db4812
parent12ced70c95fe8efbcec09a372f0af81d819bb8cd
libafscp: Can't unlock something we've freed

When we call _StatCleanup on a stored statent structure, it
deletes the mutex, and frees the structure itself. This means it
can't be called with a locked structure as the mutex deletion
will fail, and then we'll try to reference freed memory when we
later unlock that mutex.

Fix this by unlocking the mutex before calling _StatCleanup. This
is safe because the only reference to the structure visible to other
threads must have been deleted by the time we reach this point.

Caught by coverity (#986058, #986059)

Change-Id: I346d4c8a7cd478db044af919662c1cf1c093e205
Reviewed-on: http://gerrit.openafs.org/9297
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
src/libafscp/afscp_fid.c