drm/nouveau: fix a use-after-free in postclose()
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest3 patches 5 repliesIn review
- v13 patches 3 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | drm/nouveau: use drm_dev_unplug() during device removaldrivers/ | +1 | 0 replies | |
| 2/3 | drm/nouveau: Add a dedicated mutex for the clients listdrivers/ drivers/ | +11 | 0 replies | |
| 3/3 | drm/nouveau: clean up all clients on device removaldrivers/ | +30 | 0 replies |
Reviews trailers per patch
None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Lyude Paul |
|---|---|
| Series | R-b |
| 1/3 | |
| 2/3 | |
| 3/3 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/3] drm/nouveau: fix a use-after-free in postclose()
This series fixes a number of use-after-frees in nouveau's postclose() handler. It was discovered by pointing IGT's core_hotunplug tests at a nouveau device, but the steps to reproduce it are simple:
1. Open the device file
2. Unbind the driver or remove the device
3. Close the file opened in step 1.
During the device removal, the nouveau_drm structure is de-allocated, but is dereferenced in the postclose() handler.
One obvious solution is to ensure all the operations in the postclose() handler are valid by extending the lifetime of the nouveau_drm structure. This is possible with the new devm_drm_dev_alloc() interface, but the change is somewhat invasive so I thought it best to submit that work separately.
Instead, we make use of the drm_dev_unplug() API, clean up all clients in the device removal call, and check to make sure the device has not been unplugged in the postclose() handler. While this does not enable hot-unplug support for nouveau, it's enough to avoid crashing the kernel and leads to all the core_hotunplug tests to pass.
This series reroll addresses a missing mutex_destroy() call and a typo in a commit message.
Jeremy Cline (3):
drm/nouveau: use drm_dev_unplug() during device removal drm/nouveau: Add a dedicated mutex for the clients list drm/nouveau: clean up all clients on device removal
drivers/gpu/drm/nouveau/nouveau_drm.c | 42 +++++++++++++++++++++++---- drivers/gpu/drm/nouveau/nouveau_drv.h | 5 ++++ 2 files changed, 42 insertions(+), 5 deletions(-)
Signature · 1 line
2.28.0