fill_ipc_shm_hdr should ensure that the region isn't hugetlbfs-backed
before backcasting the inode to shmem_inode_info, not after.

Signed-off-by: Nathan Lynch <[email protected]>
---
 ipc/checkpoint_shm.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ipc/checkpoint_shm.c b/ipc/checkpoint_shm.c
index c8247ce..a929e33 100644
--- a/ipc/checkpoint_shm.c
+++ b/ipc/checkpoint_shm.c
@@ -58,13 +58,17 @@ static int fill_ipc_shm_hdr(struct ckpt_ctx *ctx,
                h->mlock_uid = (unsigned int) -1;
 
        h->flags = 0;
-       /* check if shm was setup with SHM_NORESERVE */
-       if (SHMEM_I(shp->shm_file->f_dentry->d_inode)->flags & VM_NORESERVE)
-               h->flags |= SHM_NORESERVE;
+
        /* check if shm was setup with SHM_HUGETLB (unsupported yet) */
        if (is_file_hugepages(shp->shm_file)) {
                pr_warning("c/r: unsupported SHM_HUGETLB\n");
                ret = -ENOSYS;
+       } else {
+               struct shmem_inode_info *info;
+
+               info = SHMEM_I(shp->shm_file->f_dentry->d_inode);
+               if (info->flags & VM_NORESERVE)
+                       h->flags |= SHM_NORESERVE;
        }
 
        ipc_unlock(&shp->shm_perm);
-- 
1.7.2.2

_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
[email protected]
https://openvz.org/mailman/listinfo/devel

Reply via email to