mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	drm/arm/malidp: fix a possible null pointer dereference
In malidp_mw_connector_reset, new memory is allocated with kzalloc, but
no check is performed. In order to prevent null pointer dereferencing,
ensure that mw_state is checked before calling
__drm_atomic_helper_connector_reset.
Fixes: 8cbc5caf36 ("drm: mali-dp: Add writeback connector")
Signed-off-by: Huai-Yuan Liu <qq810974084@gmail.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240407063053.5481-1-qq810974084@gmail.com
			
			
This commit is contained in:
		
							parent
							
								
									42118c5f68
								
							
						
					
					
						commit
						a1f95aede6
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -72,6 +72,9 @@ static void malidp_mw_connector_reset(struct drm_connector *connector)
 | 
				
			||||||
		__drm_atomic_helper_connector_destroy_state(connector->state);
 | 
							__drm_atomic_helper_connector_destroy_state(connector->state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	kfree(connector->state);
 | 
						kfree(connector->state);
 | 
				
			||||||
 | 
						connector->state = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (mw_state)
 | 
				
			||||||
		__drm_atomic_helper_connector_reset(connector, &mw_state->base);
 | 
							__drm_atomic_helper_connector_reset(connector, &mw_state->base);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue