diff options
author | Daniel Rosenberg <drosen@google.com> | 2018-02-01 16:52:22 -0800 |
---|---|---|
committer | Daniel Rosenberg <drosen@google.com> | 2018-02-02 19:32:16 -0800 |
commit | 4e74e983ab6ee28bb272bbcd317bd2d6d60e4be3 (patch) | |
tree | 37e4b23c43616c66ed01ed8aedc851bfb94b6ac9 /fs/sdcardfs/super.c | |
parent | 0989de294d189b0e8742b9296b511af20004724a (diff) |
ANDROID: sdcardfs: Protect set_top
If the top is changed while we're attempting to use it, it's
possible that the reference will be put while we are in the
process of grabbing a reference.
Now we grab a spinlock to protect grabbing our reference count.
Additionally, we now set the inode_info's top value to point to
it's own data when initializing, which makes tracking changes
easier.
Change-Id: If15748c786ce4c0480ab8c5051a92523aff284d2
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Diffstat (limited to 'fs/sdcardfs/super.c')
-rw-r--r-- | fs/sdcardfs/super.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/sdcardfs/super.c b/fs/sdcardfs/super.c index 87d6f836592e..cffcdb11cb8a 100644 --- a/fs/sdcardfs/super.c +++ b/fs/sdcardfs/super.c @@ -215,6 +215,9 @@ static struct inode *sdcardfs_alloc_inode(struct super_block *sb) i->data = d; kref_init(&d->refcount); + i->top_data = d; + spin_lock_init(&i->top_lock); + kref_get(&d->refcount); i->vfs_inode.i_version = 1; return &i->vfs_inode; |