Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22ba747f authored by Al Viro's avatar Al Viro
Browse files

jffs2: fix IN_DELETE_SELF on overwriting rename() killing a directory



We don't generate IN_DELETE_SELF on victim of overwriting rename() if
it happens to be a directory.  Trivially fixed by doing to ->i_nlink
what we do ->pino_nlink a couple of lines later in jffs2_rename().

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 841590ce
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -820,6 +820,9 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,

	if (victim_f) {
		/* There was a victim. Kill it off nicely */
		if (S_ISDIR(new_dentry->d_inode->i_mode))
			clear_nlink(new_dentry->d_inode);
		else
			drop_nlink(new_dentry->d_inode);
		/* Don't oops if the victim was a dirent pointing to an
		   inode which didn't exist. */