mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-07-23 00:35:59 +00:00
Do checking of handle code after we verify that handle could actually be
in the handle database. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2166 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
parent
bf624c727d
commit
19a49ecdce
@ -243,14 +243,6 @@ static inline int hdb_handle_get (
|
||||
|
||||
hdb_database_lock (&handle_database->lock);
|
||||
|
||||
if (check != 0xffffffff &&
|
||||
check != handle_database->handles[handle].check) {
|
||||
|
||||
hdb_database_unlock (&handle_database->lock);
|
||||
errno = EBADF;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
*instance = NULL;
|
||||
if (handle >= handle_database->handle_count) {
|
||||
hdb_database_unlock (&handle_database->lock);
|
||||
@ -264,6 +256,14 @@ static inline int hdb_handle_get (
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (check != 0xffffffff &&
|
||||
check != handle_database->handles[handle].check) {
|
||||
|
||||
hdb_database_unlock (&handle_database->lock);
|
||||
errno = EBADF;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
*instance = handle_database->handles[handle].instance;
|
||||
|
||||
handle_database->handles[handle].ref_count += 1;
|
||||
@ -281,6 +281,13 @@ static inline int hdb_handle_put (
|
||||
|
||||
hdb_database_lock (&handle_database->lock);
|
||||
|
||||
if (handle >= handle_database->handle_count) {
|
||||
hdb_database_unlock (&handle_database->lock);
|
||||
|
||||
errno = EBADF;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (check != 0xffffffff &&
|
||||
check != handle_database->handles[handle].check) {
|
||||
|
||||
@ -313,6 +320,13 @@ static inline int hdb_handle_destroy (
|
||||
|
||||
hdb_database_lock (&handle_database->lock);
|
||||
|
||||
if (handle >= handle_database->handle_count) {
|
||||
hdb_database_unlock (&handle_database->lock);
|
||||
|
||||
errno = EBADF;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (check != 0xffffffff &&
|
||||
check != handle_database->handles[handle].check) {
|
||||
hdb_database_unlock (&handle_database->lock);
|
||||
|
Loading…
Reference in New Issue
Block a user