lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 22 Jan 2021 22:22:28 +0100
From:   Richard Weinberger <richard@....at>
To:     linux-mtd@...ts.infradead.org
Cc:     david@...ma-star.at, richard@....at, linux-kernel@...r.kernel.org,
        stable@...r.kernel.org
Subject: [PATCH 3/4] ubifs: Update directory size when creating whiteouts

Although whiteouts are unlinked files they will get re-linked later,
therefore the size of the parent directory needs to be updated too.

Cc: stable@...r.kernel.org
Fixes: 9e0a1fff8db5 ("ubifs: Implement RENAME_WHITEOUT")
Signed-off-by: Richard Weinberger <richard@....at>
---
 fs/ubifs/dir.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 8a34e0118ee9..b5d523e5854f 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -361,6 +361,7 @@ static int do_tmpfile(struct inode *dir, struct dentry *dentry,
 	struct ubifs_budget_req ino_req = { .dirtied_ino = 1 };
 	struct ubifs_inode *ui, *dir_ui = ubifs_inode(dir);
 	int err, instantiated = 0;
+	int sz_change = 0;
 	struct fscrypt_name nm;
 
 	/*
@@ -411,6 +412,8 @@ static int do_tmpfile(struct inode *dir, struct dentry *dentry,
 		mark_inode_dirty(inode);
 		drop_nlink(inode);
 		*whiteout = inode;
+		sz_change = CALC_DENT_SIZE(fname_len(&nm));
+		dir->i_size += sz_change;
 	} else {
 		d_tmpfile(dentry, inode);
 	}
@@ -430,6 +433,7 @@ static int do_tmpfile(struct inode *dir, struct dentry *dentry,
 	return 0;
 
 out_cancel:
+	dir->i_size -= sz_change;
 	mutex_unlock(&dir_ui->ui_mutex);
 out_inode:
 	make_bad_inode(inode);
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ