]> git.ipfire.org Git - thirdparty/krb5.git/commit
Fix lock inconsistency in ctx_unlock()
authorNicolas Williams <nico@cryptonector.com>
Wed, 12 Sep 2012 16:36:54 +0000 (11:36 -0500)
committerGreg Hudson <ghudson@mit.edu>
Wed, 12 Sep 2012 18:49:25 +0000 (14:49 -0400)
commit29ee39baa919361ae08e26caab896890d5cb3eb4
treee958a18f3ad9b8a2321066ee77d2220180d75c2d
parentb858e776ece87756202d4c646931d35bd407e3ea
Fix lock inconsistency in ctx_unlock()

The lock inconsistency fixed here is quite possibly the same as
described in https://bugzilla.redhat.com/show_bug.cgi?id=586032 .

The problem is that ctx_unlock() fails to unlock the principal DB if
it fails to unlock the policy DB, and this happens when ctx_lock()
fails to lock the policy DB (likely because the caller is racing
against a kdb5_util load, which will be using a "permanent" lock,
meaning that the lock file will be unlinked after acquiring the
lock).  The fix is to perform both unlock operations *then* handle
any errors that either or both might have returned.

Additionally, we don't really need or want to use non-blocking locks,
and we certainly don't want to sleep(1) in krb5kdc (possibly several
times, as there was a loop over this) when either of the principal or
policy DB is locked.  Some callers still request non-blocking locks,
and ctx_lock() still honors this.

ticket: 7360 (new)
src/plugins/kdb/db2/kdb_db2.c