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-next>] [day] [month] [year] [list]
Date:	Tue,  5 May 2015 20:06:09 +0200
From:	Fabian Frederick <fabf@...net.be>
To:	linux-kernel@...r.kernel.org
Cc:	Fabian Frederick <fabf@...net.be>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Alexander Viro <viro@...iv.linux.org.uk>,
	Jan Kara <jack@...e.cz>
Subject: [PATCH 1/2 linux-next] fs/affs/inode.c: mark new inode before hashtable insertion

AFFS didn't mark new inode to I_NEW state like other FS
using insert_inode_locked() during creation.
This patch also unlocks inode when setup is complete
or operation failed.

Problem appeared when trying to add tmpfile support.

Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Cc: Jan Kara <jack@...e.cz>
Suggested-by: Jan Kara <jack@...e.cz>
Signed-off-by: Fabian Frederick <fabf@...net.be>
---
 fs/affs/inode.c | 2 ++
 fs/affs/namei.c | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 1734950..859a9cb 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -323,6 +323,8 @@ affs_new_inode(struct inode *dir)
 	AFFS_I(inode)->i_pa_cnt = 0;
 	AFFS_I(inode)->i_extcnt = 1;
 	AFFS_I(inode)->i_ext_last = ~1;
+	if (insert_inode_locked(inode) < 0)
+		goto err_inode;
 
 	insert_inode_hash(inode);
 
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index 181e05b..b183540 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -281,9 +281,11 @@ affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl)
 	error = affs_add_entry(dir, inode, dentry, ST_FILE);
 	if (error) {
 		clear_nlink(inode);
+		unlock_new_inode(inode);
 		iput(inode);
 		return error;
 	}
+	unlock_new_inode(inode);
 	return 0;
 }
 
@@ -310,9 +312,11 @@ affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 	if (error) {
 		clear_nlink(inode);
 		mark_inode_dirty(inode);
+		unlock_new_inode(inode);
 		iput(inode);
 		return error;
 	}
+	unlock_new_inode(inode);
 	return 0;
 }
 
@@ -391,11 +395,13 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
 	if (error)
 		goto err;
 
+	unlock_new_inode(inode);
 	return 0;
 
 err:
 	clear_nlink(inode);
 	mark_inode_dirty(inode);
+	unlock_new_inode(inode);
 	iput(inode);
 	return error;
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ