forked from mirrors/linux
		
	s390/mm: fix BUG_ON in crst_table_upgrade
A 31-bit compat process can force a BUG_ON in crst_table_upgrade
with specific, invalid mmap calls, e.g.
   mmap((void*) 0x7fff8000, 0x10000, 3, 32, -1, 0)
The arch_get_unmapped_area[_topdown] functions miss an if condition
in the decision to do a page table upgrade.
Fixes: 9b11c7912d ("s390/mm: simplify arch_get_unmapped_area[_topdown]")
Cc: <stable@vger.kernel.org>  # v4.12+
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
			
			
This commit is contained in:
		
							parent
							
								
									0b89ede629
								
							
						
					
					
						commit
						8ab867cb08
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -119,7 +119,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
 | 
				
			||||||
		return addr;
 | 
							return addr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
check_asce_limit:
 | 
					check_asce_limit:
 | 
				
			||||||
	if (addr + len > current->mm->context.asce_limit) {
 | 
						if (addr + len > current->mm->context.asce_limit &&
 | 
				
			||||||
 | 
						    addr + len <= TASK_SIZE) {
 | 
				
			||||||
		rc = crst_table_upgrade(mm, addr + len);
 | 
							rc = crst_table_upgrade(mm, addr + len);
 | 
				
			||||||
		if (rc)
 | 
							if (rc)
 | 
				
			||||||
			return (unsigned long) rc;
 | 
								return (unsigned long) rc;
 | 
				
			||||||
| 
						 | 
					@ -183,7 +184,8 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
check_asce_limit:
 | 
					check_asce_limit:
 | 
				
			||||||
	if (addr + len > current->mm->context.asce_limit) {
 | 
						if (addr + len > current->mm->context.asce_limit &&
 | 
				
			||||||
 | 
						    addr + len <= TASK_SIZE) {
 | 
				
			||||||
		rc = crst_table_upgrade(mm, addr + len);
 | 
							rc = crst_table_upgrade(mm, addr + len);
 | 
				
			||||||
		if (rc)
 | 
							if (rc)
 | 
				
			||||||
			return (unsigned long) rc;
 | 
								return (unsigned long) rc;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue