summaryrefslogtreecommitdiff
path: root/fs/inode.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2020-03-04 11:28:31 +0100
committerPeter Zijlstra <peterz@infradead.org>2020-03-06 11:06:15 +0100
commit8019ad13ef7f64be44d4f892af9c840179009254 (patch)
tree889b754b07fa844410d6782bc1b4473007a9bc99 /fs/inode.c
parent98d54f81e36ba3bf92172791eba5ca5bd813989b (diff)
downloadlinux-rpi-8019ad13ef7f64be44d4f892af9c840179009254.tar.gz
linux-rpi-8019ad13ef7f64be44d4f892af9c840179009254.tar.bz2
linux-rpi-8019ad13ef7f64be44d4f892af9c840179009254.zip
futex: Fix inode life-time issue
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>
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 7d57068b6b7a..93d9252a00ab 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -138,6 +138,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;