mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-11-01 09:13:37 +00:00 
			
		
		
		
	kexec: clear crashk_res if all its memory has been released
If the resource of crashk_res has been released, it is better to clear crashk_res.start and crashk_res.end. Because 'end = start - 1' is not reasonable, and in some places the test is based on crashk_res.end, not resource_size(&crashk_res). Link: https://lkml.kernel.org/r/20230527123439.772-4-thunder.leizhen@huawei.com Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Acked-by: Baoquan He <bhe@redhat.com> Cc: Cong Wang <amwang@redhat.com> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									6f22a744f4
								
							
						
					
					
						commit
						f7f567b95b
					
				
					 1 changed files with 7 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -1137,15 +1137,18 @@ int crash_shrink_memory(unsigned long new_size)
 | 
			
		|||
	end = start + new_size;
 | 
			
		||||
	crash_free_reserved_phys_range(end, crashk_res.end);
 | 
			
		||||
 | 
			
		||||
	if (start == end)
 | 
			
		||||
		release_resource(&crashk_res);
 | 
			
		||||
 | 
			
		||||
	ram_res->start = end;
 | 
			
		||||
	ram_res->end = crashk_res.end;
 | 
			
		||||
	ram_res->flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM;
 | 
			
		||||
	ram_res->name = "System RAM";
 | 
			
		||||
 | 
			
		||||
	crashk_res.end = end - 1;
 | 
			
		||||
	if (start == end) {
 | 
			
		||||
		release_resource(&crashk_res);
 | 
			
		||||
		crashk_res.start = 0;
 | 
			
		||||
		crashk_res.end = 0;
 | 
			
		||||
	} else {
 | 
			
		||||
		crashk_res.end = end - 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	insert_resource(&iomem_resource, ram_res);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue