Skip to content

treewide: Convert buses to use generic driver_override

Danilo Krummrich driver-core linux-arm-msm linux-hyperv linux-remoteproc lkml 2 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 4 repliesApplied
  2. v112 patches 30 repliesApplied

Changes in v2 from the cover letter

- Rebase on v7.1-rc1
- Drop already merged patches
- vmbus documentation changes as requested by Michael

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/5amba: use generic driver_override infrastructuredrivers/amba/bus.c include/linux/amba/bus.h+6 -360 replies
2/5cdx: use generic driver_override infrastructuredrivers/cdx/cdx.c include/linux/cdx/cdx_bus.h+5 -390 replies
3/5Drivers: hv: vmbus: use generic driver_override infrastructuredrivers/hv/vmbus_drv.c include/linux/hyperv.h+10 -380 replies
4/5rpmsg: use generic driver_override infrastructuredrivers/rpmsg/qcom_glink_native.c drivers/rpmsg/rpmsg_core.c drivers/rpmsg/virtio_rpmsg_bus.c +1 more+7 -430 replies
5/5driver core: remove driver_set_override()drivers/base/driver.c include/linux/device/driver.h+0 -770 replies

Reviews trailers per patch

3 of 5 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMichael KelleyMathieu PoirierGreg Kroah-Hartman
SeriesR-b
1/5
2/5
3/5T-b R-b
4/5R-b
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/5] treewide: Convert buses to use generic driver_override

This is the follow-up of the driver_override generalization in [1], converting the remaining 4 busses and removing the now-unused driver_set_override() helper.

All of them are prone to the potential UAF described in [2], caused by accessing the driver_override field from their corresponding match() callback.

In order to address this, the generalized driver_override field in struct device is protected with a spinlock. The driver-core provides accessors, such as device_match_driver_override(), device_has_driver_override() and device_set_driver_override(), which all ensure proper locking internally.

Additionally, the driver-core provides a driver_override flag in struct bus_type, which, once enabled, automatically registers generic sysfs callbacks, allowing userspace to modify the driver_override field.

This series is based on v7.1-rc1 with no additional dependencies, hence those patches can be picked up by subsystems individually.

[1] https://lore.kernel.org/driver-core/[email protected]/
[2] https://bugzilla.kernel.org/show_bug.cgi?id=220789
[3] https://gitlab.com/driverctl/driverctl/-/blob/0.121/driverctl?ref_type=tags#L99

Changes in v2:
- Rebase on v7.1-rc1
- Drop already merged patches
- vmbus documentation changes as requested by Michael

Danilo Krummrich (5):
amba: use generic driver_override infrastructure
cdx: use generic driver_override infrastructure
Drivers: hv: vmbus: use generic driver_override infrastructure
rpmsg: use generic driver_override infrastructure driver core: remove driver_set_override()

 drivers/amba/bus.c                | 37 +++------------
 drivers/base/driver.c             | 75 -------------------------------
 drivers/cdx/cdx.c                 | 40 +++--------------
 drivers/hv/vmbus_drv.c            | 43 +++++-------------
 drivers/rpmsg/qcom_glink_native.c |  2 -
 drivers/rpmsg/rpmsg_core.c        | 43 +++---------------
 drivers/rpmsg/virtio_rpmsg_bus.c  |  1 -
 include/linux/amba/bus.h          |  5 ---
 include/linux/cdx/cdx_bus.h       |  4 --
 include/linux/device/driver.h     |  2 -
 include/linux/hyperv.h            |  5 ---
 include/linux/rpmsg.h             |  4 --
 12 files changed, 28 insertions(+), 233 deletions(-)

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731

Signature · 1 line
2.54.0