mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	drm/i915/gvt: Check if get_next_pt_type() always returns a valid value
According to gtt_type_table[] function get_next_pt_type() may returns GTT_TYPE_INVALID in some cases. To prevent driver to try to create memory page with invalid data type, additional check is added. Signed-off-by: Aleksei Gimbitskii <aleksei.gimbitskii@intel.com> Cc: Zhenyu Wang <zhenyuw@linux.intel.com> Cc: Zhi Wang <zhi.a.wang@intel.com> Cc: Colin Xu <colin.xu@intel.com> Reviewed-by: Colin Xu <colin.xu@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
This commit is contained in:
		
							parent
							
								
									4feeea1d8d
								
							
						
					
					
						commit
						930c8dfea4
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
					@ -1076,6 +1076,9 @@ static struct intel_vgpu_ppgtt_spt *ppgtt_populate_spt_by_guest_entry(
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		int type = get_next_pt_type(we->type);
 | 
							int type = get_next_pt_type(we->type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (!gtt_type_is_pt(type))
 | 
				
			||||||
 | 
								goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		spt = ppgtt_alloc_spt_gfn(vgpu, type, ops->get_pfn(we), ips);
 | 
							spt = ppgtt_alloc_spt_gfn(vgpu, type, ops->get_pfn(we), ips);
 | 
				
			||||||
		if (IS_ERR(spt)) {
 | 
							if (IS_ERR(spt)) {
 | 
				
			||||||
			ret = PTR_ERR(spt);
 | 
								ret = PTR_ERR(spt);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue