mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	net/ncsi: Disable the ncsi work before freeing the associated structure
The work function can run after the ncsi device is freed, resulting
in use-after-free bugs or kernel panic.
Fixes: 2d283bdd07 ("net/ncsi: Resource management")
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://patch.msgid.link/20240925155523.1017097-1-eajames@linux.ibm.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
			
			
This commit is contained in:
		
							parent
							
								
									fa7dfeae04
								
							
						
					
					
						commit
						a0ffa68c70
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
					@ -1954,6 +1954,8 @@ void ncsi_unregister_dev(struct ncsi_dev *nd)
 | 
				
			||||||
	list_del_rcu(&ndp->node);
 | 
						list_del_rcu(&ndp->node);
 | 
				
			||||||
	spin_unlock_irqrestore(&ncsi_dev_lock, flags);
 | 
						spin_unlock_irqrestore(&ncsi_dev_lock, flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						disable_work_sync(&ndp->work);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	kfree(ndp);
 | 
						kfree(ndp);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL_GPL(ncsi_unregister_dev);
 | 
					EXPORT_SYMBOL_GPL(ncsi_unregister_dev);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue