mbox series

[v2,0/3] Finish constification of drm_driver in DRM core

Message ID 20201215203126.10175-1-laurent.pinchart+renesas@ideasonboard.com (mailing list archive)
Headers show
Series Finish constification of drm_driver in DRM core | expand

Message

Laurent Pinchart Dec. 15, 2020, 8:31 p.m. UTC
Hello,

This patch series finishes the constification of struct drm_driver in
the DRM core by avoiding modifications to the structure for legacy PCI
drivers. This improves security by avoiding function pointers in
writable memory.

The change turned out to be fairly easy, with preparation in patch 1/3
that moves the only non-const field out of drm_driver, and patch 2/3
that finishes the constification in the DRM core. Patch 3/3 is a
low-hanging fruit that constifies the structure in a few drivers.

The remaining non-const drivers modify the structure internally to set
the num_ioctls fields, and in a few cases, change the driver features.
This will require a bit more work to fix these cases.

Laurent Pinchart (3):
  drm: Move legacy device list out of drm_driver
  drm: Use a const drm_driver for legacy PCI devices
  drm: Constify drm_driver in drivers that don't modify it

 drivers/gpu/drm/arc/arcpgu_drv.c |  2 +-
 drivers/gpu/drm/drm_drv.c        |  4 ----
 drivers/gpu/drm/drm_pci.c        | 33 +++++++++++++++++++++-----------
 drivers/gpu/drm/kmb/kmb_drv.c    |  2 +-
 drivers/gpu/drm/tdfx/tdfx_drv.c  |  2 +-
 include/drm/drm_device.h         | 14 +++-----------
 include/drm/drm_drv.h            |  2 --
 include/drm/drm_legacy.h         | 10 ++++++----
 8 files changed, 34 insertions(+), 35 deletions(-)