mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 16:54:21 +00:00 
			
		
		
		
	batman-adv: Avoid double freeing of bat_counters
On errors in batadv_mesh_init(), bat_counters will be freed in both batadv_mesh_free() and batadv_softif_init_late(). This patch fixes this by returning earlier from batadv_softif_init_late() in case of errors in batadv_mesh_init() and by setting bat_counters to NULL after freeing. Signed-off-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
This commit is contained in:
		
							parent
							
								
									3ccfc1b1d2
								
							
						
					
					
						commit
						f69ae770e7
					
				
					 2 changed files with 2 additions and 0 deletions
				
			
		|  | @ -181,6 +181,7 @@ void batadv_mesh_free(struct net_device *soft_iface) | |||
| 	batadv_originator_free(bat_priv); | ||||
| 
 | ||||
| 	free_percpu(bat_priv->bat_counters); | ||||
| 	bat_priv->bat_counters = NULL; | ||||
| 
 | ||||
| 	atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE); | ||||
| } | ||||
|  |  | |||
|  | @ -505,6 +505,7 @@ unreg_debugfs: | |||
| 	batadv_debugfs_del_meshif(dev); | ||||
| free_bat_counters: | ||||
| 	free_percpu(bat_priv->bat_counters); | ||||
| 	bat_priv->bat_counters = NULL; | ||||
| 
 | ||||
| 	return ret; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Martin Hundebøll
						Martin Hundebøll