Skip to contentSkip to conversation

2.4.19-pre8 vm86 smp locking fix]

PATCH In review Benjamin LaHaise 2 participants 2 messages May 23, 2002 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.4.19-pre8 vm86 smp locking fix]

----- Forwarded message from Benjamin LaHaise <[email protected]> -----

Subject: [PATCH] 2.4.19-pre8 vm86 smp locking fix
From: Benjamin LaHaise <[email protected]>
To: Linux Kernel <[email protected]>, [email protected]
Date: Thu, 23 May 2002 16:51:05 -0400

arch/i386/kernel/vm86.c performs page table operations without obtaining any locks. This patch obtains page_table_lock around the the table walk and modification.

-ben

Signature · 51 lines
"You will be reincarnated as a toad; and you will be much happier."


diff -urN v2.4.19-pre8/arch/i386/kernel/vm86.c work/arch/i386/kernel/vm86.c
--- v2.4.19-pre8/arch/i386/kernel/vm86.c	Thu Mar  7 16:39:56 2002
+++ work/arch/i386/kernel/vm86.c	Thu May 23 16:21:38 2002
@@ -97,21 +97,22 @@
 	pte_t *pte;
 	int i;
 
+	spin_lock(&tsk->mm->page_table_lock);
 	pgd = pgd_offset(tsk->mm, 0xA0000);
 	if (pgd_none(*pgd))
-		return;
+		goto out;
 	if (pgd_bad(*pgd)) {
 		pgd_ERROR(*pgd);
 		pgd_clear(pgd);
-		return;
+		goto out;
 	}
 	pmd = pmd_offset(pgd, 0xA0000);
 	if (pmd_none(*pmd))
-		return;
+		goto out;
 	if (pmd_bad(*pmd)) {
 		pmd_ERROR(*pmd);
 		pmd_clear(pmd);
-		return;
+		goto out;
 	}
 	pte = pte_offset(pmd, 0xA0000);
 	for (i = 0; i < 32; i++) {
@@ -119,6 +120,8 @@
 			set_pte(pte, pte_wrprotect(*pte));
 		pte++;
 	}
+out:
+	spin_unlock(&tsk->mm->page_table_lock);
 	flush_tlb();
 }
 

----- End forwarded message -----

-- 
"You will be reincarnated as a toad; and you will be much happier."
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/
#1 lore raw
Quoted 3 lines · Benjamin LaHaise

arch/i386/kernel/vm86.c performs page table operations without obtaining any locks. This patch obtains page_table_lock around the the table walk and modification.

Looks correct to me; IMHO it should be applied.

Cheers,
Bill
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/