aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/nvdimm
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-06-26 14:27:08 +0200
committerJason Gunthorpe <jgg@mellanox.com>2019-07-02 14:32:44 -0300
commit1e240e8d4a7d92232b6214e02a0a4197a53afd6c (patch)
tree79627ced555b058e23eedd971352ee51918e5dcd /tools/testing/nvdimm
parentmemremap: validate the pagemap type passed to devm_memremap_pages (diff)
downloadlinux-dev-1e240e8d4a7d92232b6214e02a0a4197a53afd6c.tar.xz
linux-dev-1e240e8d4a7d92232b6214e02a0a4197a53afd6c.zip
memremap: move dev_pagemap callbacks into a separate structure
The dev_pagemap is a growing too many callbacks. Move them into a separate ops structure so that they are not duplicated for multiple instances, and an attacker can't easily overwrite them. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Logan Gunthorpe <logang@deltatee.com> Reviewed-by: Jason Gunthorpe <jgg@mellanox.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Tested-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'tools/testing/nvdimm')
-rw-r--r--tools/testing/nvdimm/test/iomap.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/testing/nvdimm/test/iomap.c b/tools/testing/nvdimm/test/iomap.c
index 076df22e4bda..cf3f064a697d 100644
--- a/tools/testing/nvdimm/test/iomap.c
+++ b/tools/testing/nvdimm/test/iomap.c
@@ -100,9 +100,10 @@ static void nfit_test_kill(void *_pgmap)
{
struct dev_pagemap *pgmap = _pgmap;
- WARN_ON(!pgmap || !pgmap->ref || !pgmap->kill || !pgmap->cleanup);
- pgmap->kill(pgmap->ref);
- pgmap->cleanup(pgmap->ref);
+ WARN_ON(!pgmap || !pgmap->ref || !pgmap->ops || !pgmap->ops->kill ||
+ !pgmap->ops->cleanup);
+ pgmap->ops->kill(pgmap->ref);
+ pgmap->ops->cleanup(pgmap->ref);
}
void *__wrap_devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap)