mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	dma-direct check for highmem pages in dma_direct_alloc_pages
Check for highmem pages from CMA, just like in the dma_direct_alloc path. Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
		
							parent
							
								
									9f4df96b87
								
							
						
					
					
						commit
						08a89c2830
					
				
					 1 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
					@ -309,6 +309,17 @@ struct page *dma_direct_alloc_pages(struct device *dev, size_t size,
 | 
				
			||||||
	page = __dma_direct_alloc_pages(dev, size, gfp);
 | 
						page = __dma_direct_alloc_pages(dev, size, gfp);
 | 
				
			||||||
	if (!page)
 | 
						if (!page)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
						if (PageHighMem(page)) {
 | 
				
			||||||
 | 
							/*
 | 
				
			||||||
 | 
							 * Depending on the cma= arguments and per-arch setup
 | 
				
			||||||
 | 
							 * dma_alloc_contiguous could return highmem pages.
 | 
				
			||||||
 | 
							 * Without remapping there is no way to return them here,
 | 
				
			||||||
 | 
							 * so log an error and fail.
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
							dev_info(dev, "Rejecting highmem page from CMA.\n");
 | 
				
			||||||
 | 
							goto out_free_pages;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = page_address(page);
 | 
						ret = page_address(page);
 | 
				
			||||||
	if (force_dma_unencrypted(dev)) {
 | 
						if (force_dma_unencrypted(dev)) {
 | 
				
			||||||
		if (set_memory_decrypted((unsigned long)ret,
 | 
							if (set_memory_decrypted((unsigned long)ret,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue