summaryrefslogtreecommitdiff
path: root/fs/inode.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2020-03-04 11:28:31 +0100
committerPanwar Vijay Kumar <pvijayku@codeaurora.org>2021-09-28 13:53:25 +0530
commit228bbfb250329a8e39c3e3b07a345c239d171aff (patch)
tree407a791f78fbd521f8474fad406aa5335291258f /fs/inode.c
parent7504736e87258b542aeedf47460364b30b8cb79d (diff)
futex: Fix inode life-time issue
commit 8019ad13ef7f64be44d4f892af9c840179009254 upstream. As reported by Jann, ihold() does not in fact guarantee inode persistence. And instead of making it so, replace the usage of inode pointers with a per boot, machine wide, unique inode identifier. This sequence number is global, but shared (file backed) futexes are rare enough that this should not become a performance issue. Reported-by: Jann Horn <jannh@google.com> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Git-commit:24bbfe34bb44c036c3a0874bf74fc2387d5557bf Git-repo: https://android.googlesource.com/kernel/common/ Change-Id: I2c28eac963cef6ed8b389fbdb079e355e3c36cc0 Signed-off-by: pvijayku <pvijayku@codeaurora.org>
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 8e811a0e6be1..28c8c265f2f6 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -135,6 +135,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
inode->i_sb = sb;
inode->i_blkbits = sb->s_blocksize_bits;
inode->i_flags = 0;
+ atomic64_set(&inode->i_sequence, 0);
atomic_set(&inode->i_count, 1);
inode->i_op = &empty_iops;
inode->i_fop = &no_open_fops;