diff options
author | Dan Williams <dan.j.williams@intel.com> | 2021-04-01 07:33:19 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2021-04-06 11:41:30 -0700 |
commit | 5877515912cc4f0d67071b7cee15076ebef24708 (patch) | |
tree | 26d67ea57a15e33606c0a064f76b6f0f6ca51caf /mm/process_vm_access.c | |
parent | 6eff5721933c08c3b76d6126aee24d8f134518ef (diff) | |
download | lwn-5877515912cc4f0d67071b7cee15076ebef24708.tar.gz lwn-5877515912cc4f0d67071b7cee15076ebef24708.zip |
cxl/mem: Fix synchronization mechanism for device removal vs ioctl operations
The percpu_ref to gate whether cxl_memdev_ioctl() is free to use the
driver context (@cxlm) to issue I/O is overkill, implemented incorrectly
(missing a device reference before accessing the percpu_ref), and the
complexities of shutting down a percpu_ref contributed to a bug in the
error unwind in cxl_mem_add_memdev() (missing put_device() to be fixed
separately).
Use an rwsem to explicitly synchronize the usage of cxlmd->cxlm, and add
the missing reference counting for cxlmd in cxl_memdev_open() and
cxl_memdev_release_file().
Fixes: b39cb1052a5c ("cxl/mem: Register CXL memX devices")
Reported-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/161728759948.2474381.17481500816783671817.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'mm/process_vm_access.c')
0 files changed, 0 insertions, 0 deletions