2.0.33 memory corruption bug_fix

Andrea Arcangeli (arcangeli@mbox.queen.it)
Fri, 3 Apr 1998 22:56:11 +0200 (CEST)


This bug was corrputing and resetting my 2.0.33 box when it went out of
memory.

Here the fix.

--- linux/CREDITS 1998/04/04 11:27:12 1.1
+++ linux/CREDITS 1998/04/04 11:29:32
@@ -35,6 +35,15 @@
S: San Jose, California 95129
S: USA

+N: Andrea Arcangeli
+E: arcangeli@mbox.queen.it
+W: http://www.cs.unibo.it/~arcangel/
+P: 1024/CB4660B9 CC A0 71 81 F4 A0 63 AC C0 4B 81 1D 8C 15 C8 E5
+D: Fixed a 2.0.33 mm bug that corrupts memory in linux/mm/vmalloc.c
+S: Via Ciaclini 26
+S: Imola 40026
+S: Italy
+
N: Derek Atkins
E: warlord@MIT.EDU
D: Linux-AFS Port, random kernel hacker,
--- linux/mm/vmalloc.c 1998/04/04 11:27:22 1.1
+++ linux/mm/vmalloc.c 1998/04/04 11:27:32
@@ -143,10 +143,8 @@
pte_t * pte = pte_alloc_kernel(pmd, address);
if (!pte)
return -ENOMEM;
- if (alloc_area_pte(pte, address, end - address)) {
- pte_free_kernel(pte);
+ if (alloc_area_pte(pte, address, end - address))
return -ENOMEM;
- }
address = (address + PMD_SIZE) & PMD_MASK;
pmd++;
}
@@ -164,10 +162,8 @@
pmd_t *pmd = pmd_alloc_kernel(dir, address);
if (!pmd)
return -ENOMEM;
- if (alloc_area_pmd(pmd, address, end - address)) {
- pmd_free_kernel(pmd);
+ if (alloc_area_pmd(pmd, address, end - address))
return -ENOMEM;
- }
set_pgdir(address, *dir);
address = (address + PGDIR_SIZE) & PGDIR_MASK;
dir++;
@@ -228,10 +224,8 @@
pmd_t *pmd = pmd_alloc_kernel(dir, address);
if (!pmd)
return -ENOMEM;
- if (remap_area_pmd(pmd, address, end - address, offset + address)) {
- pmd_free_kernel(pmd);
+ if (remap_area_pmd(pmd, address, end - address, offset + address))
return -ENOMEM;
- }
set_pgdir(address, *dir);
address = (address + PGDIR_SIZE) & PGDIR_MASK;
dir++;

Andrea[s] Arcangeli

PS. Really the CREDIT is not so big since this patch is a reverse
of a part of 2.0.33 ;-).

PPS. I hope this is the right fix but at least works for me...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu