diff options
author | Dave Hansen <dave.hansen@linux.intel.com> | 2014-12-12 19:58:22 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-13 15:42:52 -0500 |
commit | 07a46ed27dc6344de831a450df82336270a157a9 (patch) | |
tree | 01d7b8df9f8419878ab9e6ff0678ee26ae20d00c | |
parent | d3c97900b427b8d5a476fdfe484267f09df418d6 (diff) |
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>
-rw-r--r-- | ipc/shm.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -219,7 +219,8 @@ static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp) | |||
219 | if (!is_file_hugepages(shm_file)) | 219 | if (!is_file_hugepages(shm_file)) |
220 | shmem_lock(shm_file, 0, shp->mlock_user); | 220 | shmem_lock(shm_file, 0, shp->mlock_user); |
221 | else if (shp->mlock_user) | 221 | else if (shp->mlock_user) |
222 | user_shm_unlock(file_inode(shm_file)->i_size, shp->mlock_user); | 222 | user_shm_unlock(i_size_read(file_inode(shm_file)), |
223 | shp->mlock_user); | ||
223 | fput(shm_file); | 224 | fput(shm_file); |
224 | ipc_rcu_putref(shp, shm_rcu_free); | 225 | ipc_rcu_putref(shp, shm_rcu_free); |
225 | } | 226 | } |
@@ -1280,7 +1281,7 @@ SYSCALL_DEFINE1(shmdt, char __user *, shmaddr) | |||
1280 | * in the range we are unmapping. | 1281 | * in the range we are unmapping. |
1281 | */ | 1282 | */ |
1282 | file = vma->vm_file; | 1283 | file = vma->vm_file; |
1283 | size = file_inode(file)->i_size; | 1284 | size = i_size_read(file_inode(vma->vm_file)); |
1284 | do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start); | 1285 | do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start); |
1285 | /* | 1286 | /* |
1286 | * We discovered the size of the shm segment, so | 1287 | * We discovered the size of the shm segment, so |