lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 13 Apr 2017 12:11:06 +0530
From:   Pankaj Gupta <pagupta@...hat.com>
To:     linux-kernel@...r.kernel.org, linux-rt-users@...r.kernel.org
Cc:     akpm@...ux-foundation.org, mingo@...nel.org,
        niklas.soderlund+renesas@...natech.se, vinod.koul@...el.com,
        luto@...nel.org, ville.syrjala@...ux.intel.com,
        miles.chen@...iatek.com, mtosatti@...hat.com
Subject: [PATCH] dma-debug: Make locking to work for RT

Interrupt enable/disabled with spinlock is not a valid
implementation for RT as it can make executing task to 
sleep from a non-sleepable context. So, converting it 
to spin_lock_irq[save, restore].

Signed-off-by: Pankaj Gupta <pagupta@...hat.com>
---
 lib/dma-debug.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index b157b46..fe4d50c 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -942,21 +942,17 @@ static int device_dma_allocations(struct device *dev, struct dma_debug_entry **o
 	unsigned long flags;
 	int count = 0, i;
 
-	local_irq_save(flags);
-
 	for (i = 0; i < HASH_SIZE; ++i) {
-		spin_lock(&dma_entry_hash[i].lock);
+		spin_lock_irqsave(&dma_entry_hash[i].lock, flags);
 		list_for_each_entry(entry, &dma_entry_hash[i].list, list) {
 			if (entry->dev == dev) {
 				count += 1;
 				*out_entry = entry;
 			}
 		}
-		spin_unlock(&dma_entry_hash[i].lock);
+		spin_unlock_irqrestore(&dma_entry_hash[i].lock, flags);
 	}
 
-	local_irq_restore(flags);
-
 	return count;
 }
 
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ