mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	ovl: fix nlink leak in ovl_rename()
This patch fixes an overlay inode nlink leak in the case where ovl_rename() renames over a non-dir. This is not so critical, because overlay inode doesn't rely on nlink dropping to zero for inode deletion. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
		
							parent
							
								
									7f53b7d047
								
							
						
					
					
						commit
						f681eb1d5c
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1046,6 +1046,13 @@ static int ovl_rename(struct inode *olddir, struct dentry *old,
 | 
			
		|||
	if (cleanup_whiteout)
 | 
			
		||||
		ovl_cleanup(old_upperdir->d_inode, newdentry);
 | 
			
		||||
 | 
			
		||||
	if (overwrite && d_inode(new)) {
 | 
			
		||||
		if (new_is_dir)
 | 
			
		||||
			clear_nlink(d_inode(new));
 | 
			
		||||
		else
 | 
			
		||||
			drop_nlink(d_inode(new));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ovl_dentry_version_inc(old->d_parent);
 | 
			
		||||
	ovl_dentry_version_inc(new->d_parent);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue