diff options
author | Christoph Hellwig <hch@lst.de> | 2020-03-16 20:32:13 +0100 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2020-03-26 14:33:37 -0300 |
commit | f894ddd5ff01d3bb48faf4dc533536bf5269c17a (patch) | |
tree | 6e62359994be7d1e61aab32864b6cc399cbb09e5 /mm/memremap.c | |
parent | 5a0c38d307afde167175602aa52ca4e6c5c42c44 (diff) | |
download | linux-stable-f894ddd5ff01d3bb48faf4dc533536bf5269c17a.tar.gz linux-stable-f894ddd5ff01d3bb48faf4dc533536bf5269c17a.tar.bz2 linux-stable-f894ddd5ff01d3bb48faf4dc533536bf5269c17a.zip |
memremap: add an owner field to struct dev_pagemap
Add a new opaque owner field to struct dev_pagemap, which will allow the
hmm and migrate_vma code to identify who owns ZONE_DEVICE memory, and
refuse to work on mappings not owned by the calling entity.
Link: https://lore.kernel.org/r/20200316193216.920734-2-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
Tested-by: Bharata B Rao <bharata@linux.ibm.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'mm/memremap.c')
-rw-r--r-- | mm/memremap.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/memremap.c b/mm/memremap.c index 09b5b7adc773..9b2c97ceb775 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -181,6 +181,10 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) WARN(1, "Missing migrate_to_ram method\n"); return ERR_PTR(-EINVAL); } + if (!pgmap->owner) { + WARN(1, "Missing owner\n"); + return ERR_PTR(-EINVAL); + } break; case MEMORY_DEVICE_FS_DAX: if (!IS_ENABLED(CONFIG_ZONE_DEVICE) || |