summaryrefslogtreecommitdiffstats
path: root/pcilib/locking.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-08-05 18:11:59 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-08-05 18:11:59 +0200
commit7c5897933f4f64594602b2e38264af705c061754 (patch)
treeb6051387f6e2ff6c995141ba9bcb6960ecdd0b6a /pcilib/locking.c
parentf2e47ba725cc7ba477d3a788addc974f2b18d36f (diff)
downloadpcitool-7c5897933f4f64594602b2e38264af705c061754.tar.gz
pcitool-7c5897933f4f64594602b2e38264af705c061754.tar.bz2
pcitool-7c5897933f4f64594602b2e38264af705c061754.tar.xz
pcitool-7c5897933f4f64594602b2e38264af705c061754.zip
Use global locks to protect kmem allocation to prevent race while allocating simmultaneously locking kmem pages and any other type of kmem
Diffstat (limited to 'pcilib/locking.c')
-rw-r--r--pcilib/locking.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/pcilib/locking.c b/pcilib/locking.c
index ffd05ce..7a32605 100644
--- a/pcilib/locking.c
+++ b/pcilib/locking.c
@@ -46,11 +46,10 @@ int pcilib_init_locking(pcilib_t* ctx) {
}
ctx->locks.locking = pcilib_get_lock(ctx, PCILIB_LOCK_FLAG_UNLOCKED, "locking");
- ctx->locks.mmap = pcilib_get_lock(ctx, PCILIB_LOCK_FLAG_UNLOCKED, "mmap");
pcilib_unlock_global(ctx);
- if ((!ctx->locks.locking)||(!ctx->locks.mmap)) {
+ if ((!ctx->locks.locking)) {
pcilib_error("Locking subsystem has failed to initialized mandatory global locks");
return PCILIB_ERROR_FAILED;
}
@@ -62,9 +61,6 @@ int pcilib_init_locking(pcilib_t* ctx) {
* this functions destroy all locks and then free the kernel memory allocated for them
*/
void pcilib_free_locking(pcilib_t *ctx) {
- if (ctx->locks.mmap)
- pcilib_return_lock(ctx, PCILIB_LOCK_FLAGS_DEFAULT, ctx->locks.mmap);
-
if (ctx->locks.locking)
pcilib_return_lock(ctx, PCILIB_LOCK_FLAGS_DEFAULT, ctx->locks.locking);