summaryrefslogtreecommitdiffstats
path: root/driver/kmem.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2016-03-02 20:05:25 +0100
committerSuren A. Chilingaryan <csa@suren.me>2016-03-02 20:05:25 +0100
commit7e39a6c8ae5c3f95b3b2895c4ce8d858c7ad3b79 (patch)
tree845144fdc9918a53b28fa9765f80579001df12a9 /driver/kmem.c
parent1120e8745ccd3e512fe2016c9e5092fcd378490a (diff)
downloadpcitool-7e39a6c8ae5c3f95b3b2895c4ce8d858c7ad3b79.tar.gz
pcitool-7e39a6c8ae5c3f95b3b2895c4ce8d858c7ad3b79.tar.bz2
pcitool-7e39a6c8ae5c3f95b3b2895c4ce8d858c7ad3b79.tar.xz
pcitool-7e39a6c8ae5c3f95b3b2895c4ce8d858c7ad3b79.zip
Minor change of logic in pcidriver_kmem_free_check() resulting in less complains while de-referencing the shared non-persistent kernel memory
Diffstat (limited to 'driver/kmem.c')
-rw-r--r--driver/kmem.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/driver/kmem.c b/driver/kmem.c
index 47d1929..522f3bc 100644
--- a/driver/kmem.c
+++ b/driver/kmem.c
@@ -239,6 +239,9 @@ static int pcidriver_kmem_free_check(pcidriver_privdata_t *privdata, kmem_handle
if (kmem_handle->flags&KMEM_FLAG_REUSE)
return 0;
+ if (((kmem_entry->mode&KMEM_MODE_EXCLUSIVE)==0)&&(kmem_entry->mode&KMEM_MODE_COUNT)&&((kmem_handle->flags&KMEM_FLAG_EXCLUSIVE)==0))
+ return 0;
+
if (kmem_entry->refs) {
kmem_entry->mode += 1;
mod_info("can't free referenced kmem_entry, refs = %lx\n", kmem_entry->refs);
@@ -251,8 +254,6 @@ static int pcidriver_kmem_free_check(pcidriver_privdata_t *privdata, kmem_handle
return -EBUSY;
}
- if (((kmem_entry->mode&KMEM_MODE_EXCLUSIVE)==0)&&(kmem_entry->mode&KMEM_MODE_COUNT)&&((kmem_handle->flags&KMEM_FLAG_EXCLUSIVE)==0))
- return 0;
} else {
if (kmem_entry->refs&KMEM_REF_HW)
pcidriver_module_put(privdata);