summaryrefslogtreecommitdiff
path: root/ipc
diff options
context:
space:
mode:
authorDave Hansen <dave.hansen@linux.intel.com>2014-12-13 03:58:22 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-13 23:42:52 +0300
commit07a46ed27dc6344de831a450df82336270a157a9 (patch)
tree01d7b8df9f8419878ab9e6ff0678ee26ae20d00c /ipc
parentd3c97900b427b8d5a476fdfe484267f09df418d6 (diff)
downloadlinux-07a46ed27dc6344de831a450df82336270a157a9.tar.xz
shmdt: use i_size_read() instead of ->i_size
Andrew Morton noted http://lkml.kernel.org/r/20141104142027.a7a0d010772d84560b445f59@linux-foundation.org that the shmdt uses inode->i_size outside of i_mutex being held. There is one more case in shm.c in shm_destroy(). This converts both users over to use i_size_read(). Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Cc: Manfred Spraul <manfred@colorfullife.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/shm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index e5dc7d246f05..19633b4a2350 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -219,7 +219,8 @@ static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
if (!is_file_hugepages(shm_file))
shmem_lock(shm_file, 0, shp->mlock_user);
else if (shp->mlock_user)
- user_shm_unlock(file_inode(shm_file)->i_size, shp->mlock_user);
+ user_shm_unlock(i_size_read(file_inode(shm_file)),
+ shp->mlock_user);
fput(shm_file);
ipc_rcu_putref(shp, shm_rcu_free);
}
@@ -1280,7 +1281,7 @@ SYSCALL_DEFINE1(shmdt, char __user *, shmaddr)
* in the range we are unmapping.
*/
file = vma->vm_file;
- size = file_inode(file)->i_size;
+ size = i_size_read(file_inode(vma->vm_file));
do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start);
/*
* We discovered the size of the shm segment, so