summaryrefslogtreecommitdiffstats
path: root/pcilib/lock.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/lock.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/lock.c')
-rw-r--r--pcilib/lock.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pcilib/lock.c b/pcilib/lock.c
index f1cbc56..13e363a 100644
--- a/pcilib/lock.c
+++ b/pcilib/lock.c
@@ -140,7 +140,10 @@ const char *pcilib_lock_get_name(pcilib_lock_t *lock) {
int pcilib_lock_custom(pcilib_lock_t *lock, pcilib_lock_flags_t flags, pcilib_timeout_t timeout) {
int err;
- if (!lock) return 0;
+ if (!lock) {
+ pcilib_error("The null lock pointer is passed to lock function");
+ return PCILIB_ERROR_INVALID_ARGUMENT;
+ }
struct timespec tm;