From 7e39a6c8ae5c3f95b3b2895c4ce8d858c7ad3b79 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 2 Mar 2016 20:05:25 +0100 Subject: Minor change of logic in pcidriver_kmem_free_check() resulting in less complains while de-referencing the shared non-persistent kernel memory --- driver/kmem.c | 5 +++-- 1 file 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); -- cgit v1.2.3