Skip to content

Commit a5e696e

Browse files
Greg Ungererralfbaechle
authored andcommitted
MIPS: 64-bit: Fix system lockup.
The address range size calculation inside local_flush_tlb_kernel_range() is being truncated by a too small size variable holder on 64-bit systems. The truncated size can result in an erroneous tlbsize check that means we sit spinning inside a loop trying to flush a hige number of TLB entries. This is for all intents and purposes a system hang. Fix by using an appropriately sized valiable to hold the size. [Ralf: Greg's original patch submission identified the issue and fixed one instance in tlb-r4k.c but there there were several more. For consistency I also modified tlb-r3k.c even though that file is only used on 32-bit.] Signed-off-by: Greg Ungerer <[email protected]> Signed-off-by: Ralf Baechle <[email protected]>
1 parent 195d1a9 commit a5e696e

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

arch/mips/mm/tlb-r3k.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
8282
int cpu = smp_processor_id();
8383

8484
if (cpu_context(cpu, mm) != 0) {
85-
unsigned long flags;
86-
int size;
85+
unsigned long size, flags;
8786

8887
#ifdef DEBUG_TLB
8988
printk("[tlbrange<%lu,0x%08lx,0x%08lx>]",
@@ -121,8 +120,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
121120

122121
void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
123122
{
124-
unsigned long flags;
125-
int size;
123+
unsigned long size, flags;
126124

127125
#ifdef DEBUG_TLB
128126
printk("[tlbrange<%lu,0x%08lx,0x%08lx>]", start, end);

arch/mips/mm/tlb-r4k.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
117117
int cpu = smp_processor_id();
118118

119119
if (cpu_context(cpu, mm) != 0) {
120-
unsigned long flags;
121-
int size;
120+
unsigned long size, flags;
122121

123122
ENTER_CRITICAL(flags);
124123
size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
@@ -160,8 +159,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
160159

161160
void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
162161
{
163-
unsigned long flags;
164-
int size;
162+
unsigned long size, flags;
165163

166164
ENTER_CRITICAL(flags);
167165
size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;

arch/mips/mm/tlb-r8k.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
111111
/* Usable for KV1 addresses only! */
112112
void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
113113
{
114-
unsigned long flags;
115-
int size;
114+
unsigned long size, flags;
116115

117116
size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
118117
size = (size + 1) >> 1;

0 commit comments

Comments
 (0)