]> pilppa.com Git - linux-2.6-omap-h63xx.git/commit
[PATCH] Keys: Fix key serial number collision handling
authorDavid Howells <dhowells@redhat.com>
Tue, 6 Feb 2007 13:45:51 +0000 (13:45 +0000)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 6 Feb 2007 22:45:00 +0000 (14:45 -0800)
commit9ad0830f307bcd8dc285cfae58998d43b21727f4
tree237119861640847301c6af758650b05ea353a1da
parent768c242b30d9ec5581dd245e8289acb6b77815d1
[PATCH] Keys: Fix key serial number collision handling

Fix the key serial number collision avoidance code in key_alloc_serial().

This didn't use to be so much of a problem as the key serial numbers were
allocated from a simple incremental counter, and it would have to go through
two billion keys before it could possibly encounter a collision.  However, now
that random numbers are used instead, collisions are much more likely.

This is fixed by finding a hole in the rbtree where the next unused serial
number ought to be and using that by going almost back to the top of the
insertion routine and redoing the insertion with the new serial number rather
than trying to be clever and attempting to work out the insertion point
pointer directly.

This fixes kernel BZ #7727.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
security/keys/key.c