|
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14, v6.14-rc7 |
|
| #
18daa524 |
| 11-Mar-2025 |
Dmitry Torokhov <[email protected]> |
driver core: fix potential NULL pointer dereference in dev_uevent()
If userspace reads "uevent" device attribute at the same time as another threads unbinds the device from its driver, change to dev
driver core: fix potential NULL pointer dereference in dev_uevent()
If userspace reads "uevent" device attribute at the same time as another threads unbinds the device from its driver, change to dev->driver from a valid pointer to NULL may result in crash. Fix this by using READ_ONCE() when fetching the pointer, and take bus' drivers klist lock to make sure driver instance will not disappear while we access it.
Use WRITE_ONCE() when setting the driver pointer to ensure there is no tearing.
Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Masami Hiramatsu (Google) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
04d3e546 |
| 11-Mar-2025 |
Dmitry Torokhov <[email protected]> |
driver core: introduce device_set_driver() helper
In preparation to closing a race when reading driver pointer in dev_uevent() code, instead of setting device->driver pointer directly introduce devi
driver core: introduce device_set_driver() helper
In preparation to closing a race when reading driver pointer in dev_uevent() code, instead of setting device->driver pointer directly introduce device_set_driver() helper.
Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Masami Hiramatsu (Google) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc6, v6.14-rc5, v6.14-rc4, v6.14-rc3 |
|
| #
35fa2d88 |
| 10-Feb-2025 |
Greg Kroah-Hartman <[email protected]> |
driver core: add a faux bus for use when a simple device/bus is needed
Many drivers abuse the platform driver/bus system as it provides a simple way to create and bind a device to a driver-specific
driver core: add a faux bus for use when a simple device/bus is needed
Many drivers abuse the platform driver/bus system as it provides a simple way to create and bind a device to a driver-specific set of probe/release functions. Instead of doing that, and wasting all of the memory associated with a platform device, here is a "faux" bus that can be used instead.
Reviewed-by: Jonathan Cameron <[email protected]> Reviewed-by: Danilo Krummrich <[email protected]> Reviewed-by: Lyude Paul <[email protected]> Reviewed-by: Thomas Weißschuh <[email protected]> Reviewed-by: Zijun Hu <[email protected]> Link: https://lore.kernel.org/r/2025021026-atlantic-gibberish-3f0c@gregkh Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc2, v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3, v6.13-rc2, v6.13-rc1, v6.12, v6.12-rc7, v6.12-rc6, v6.12-rc5, v6.12-rc4, v6.12-rc3, v6.12-rc2, v6.12-rc1 |
|
| #
2efddb55 |
| 25-Sep-2024 |
Greg Kroah-Hartman <[email protected]> |
Revert "driver core: shut down devices asynchronously"
This reverts commit 8064952c65045f05ee2671fe437770e50c151776.
The series is being reverted before -rc1 as there are still reports of lockups o
Revert "driver core: shut down devices asynchronously"
This reverts commit 8064952c65045f05ee2671fe437770e50c151776.
The series is being reverted before -rc1 as there are still reports of lockups on shutdown, so it's not quite ready for "prime time."
Reported-by: Andrey Skvortsov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: Christoph Hellwig <[email protected]> Cc: David Jeffery <[email protected]> Cc: Keith Busch <[email protected]> Cc: Laurence Oberman <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Sagi Grimberg <[email protected]> Cc: Stuart Hayes <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.11, v6.11-rc7, v6.11-rc6, v6.11-rc5 |
|
| #
8064952c |
| 22-Aug-2024 |
Stuart Hayes <[email protected]> |
driver core: shut down devices asynchronously
Add code to allow asynchronous shutdown of devices, ensuring that each device is shut down before its parents & suppliers.
Only devices with drivers th
driver core: shut down devices asynchronously
Add code to allow asynchronous shutdown of devices, ensuring that each device is shut down before its parents & suppliers.
Only devices with drivers that have async_shutdown_enable enabled will be shut down asynchronously.
This can dramatically reduce system shutdown/reboot time on systems that have multiple devices that take many seconds to shut down (like certain NVMe drives). On one system tested, the shutdown time went from 11 minutes without this patch to 55 seconds with the patch.
Signed-off-by: Stuart Hayes <[email protected]> Signed-off-by: David Jeffery <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Keith Busch <[email protected]> Tested-by: Keith Busch <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.11-rc4, v6.11-rc3, v6.11-rc2, v6.11-rc1 |
|
| #
0314647d |
| 25-Jul-2024 |
Zijun Hu <[email protected]> |
driver core: Remove unused parameter for virtual_device_parent()
Function struct kobject *virtual_device_parent(struct device *dev) does not use its parameter @dev, and the kobject returned also has
driver core: Remove unused parameter for virtual_device_parent()
Function struct kobject *virtual_device_parent(struct device *dev) does not use its parameter @dev, and the kobject returned also has nothing deal with specific device, so remove the unused parameter.
Signed-off-by: Zijun Hu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.10 |
|
| #
67c1ba55 |
| 08-Jul-2024 |
Greg Kroah-Hartman <[email protected]> |
driver core: module: make module_[add|remove]_driver take a const *
The functions module_add_driver() and module_remove_driver() do not modify the struct device_driver structure directly, so they ar
driver core: module: make module_[add|remove]_driver take a const *
The functions module_add_driver() and module_remove_driver() do not modify the struct device_driver structure directly, so they are safe to be marked as a constant pointer type.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/2024070850-entering-grandson-205e@gregkh Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.10-rc7 |
|
| #
d69d8048 |
| 01-Jul-2024 |
Greg Kroah-Hartman <[email protected]> |
driver core: have match() callback in struct bus_type take a const *
In the match() callback, the struct device_driver * should not be changed, so change the function callback to be a const *. This
driver core: have match() callback in struct bus_type take a const *
In the match() callback, the struct device_driver * should not be changed, so change the function callback to be a const *. This is one step of many towards making the driver core safe to have struct device_driver in read-only memory.
Because the match() callback is in all busses, all busses are modified to handle this properly. This does entail switching some container_of() calls to container_of_const() to properly handle the constant *.
For some busses, like PCI and USB and HV, the const * is cast away in the match callback as those busses do want to modify those structures at this point in time (they have a local lock in the driver structure.) That will have to be changed in the future if they wish to have their struct device * in read-only-memory.
Cc: Rafael J. Wysocki <[email protected]> Reviewed-by: Alex Elder <[email protected]> Acked-by: Sumit Garg <[email protected]> Link: https://lore.kernel.org/r/2024070136-wrongdoer-busily-01e8@gregkh Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.10-rc6, v6.10-rc5, v6.10-rc4 |
|
| #
269e974e |
| 14-Jun-2024 |
Greg Kroah-Hartman <[email protected]> |
driver core: make [device_]driver_attach take a const *
Change device_driver_attach() and driver_attach() to take a const * to struct device driver as neither of them modify the structure at all.
A
driver core: make [device_]driver_attach take a const *
Change device_driver_attach() and driver_attach() to take a const * to struct device driver as neither of them modify the structure at all.
Also, for some odd reason, drivers/dma/idxd/compat.c had a duplicate external reference to device_driver_attach(), so remove that to fix up the build, it should never have had that there in the first place.
Cc: Rafael J. Wysocki <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: Dave Jiang <[email protected]> Cc: Vinod Koul <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Petr Tesarik <[email protected]> Cc: Alexander Lobakin <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/2024061401-rasping-manger-c385@gregkh Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
c6c631d2 |
| 11-Jun-2024 |
Greg Kroah-Hartman <[email protected]> |
driver core: mark async_driver as a const *
Within struct device_private, mark the async_driver * as const as it is never modified. This requires some internal-to-the-driver-core functions to also
driver core: mark async_driver as a const *
Within struct device_private, mark the async_driver * as const as it is never modified. This requires some internal-to-the-driver-core functions to also have their parameters marked as constant, and there is one place where we cast _back_ from the const pointer to a real one, as the driver core still wants to modify the structure in a number of remaining places.
Cc: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
f6e98ef5 |
| 11-Jun-2024 |
Greg Kroah-Hartman <[email protected]> |
driver core: make driver_detach() take a const *
driver_detach() does not modify the driver itself, so make the pointer constant. In doing so, the function driver_allows_async_probing() also needs
driver core: make driver_detach() take a const *
driver_detach() does not modify the driver itself, so make the pointer constant. In doing so, the function driver_allows_async_probing() also needs to be changed so that the pointer type passes through to that function properly.
Cc: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
33ebea9b |
| 11-Jun-2024 |
Greg Kroah-Hartman <[email protected]> |
driver core: make device_release_driver_internal() take a const *
Change device_release_driver_internal() to take a const struct device_driver * as it is not modifying it at all.
Cc: Rafael J. Wyso
driver core: make device_release_driver_internal() take a const *
Change device_release_driver_internal() to take a const struct device_driver * as it is not modifying it at all.
Cc: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
0725e8f9 |
| 11-Jun-2024 |
Greg Kroah-Hartman <[email protected]> |
driver core: driver: mark driver_add/remove_groups constant
driver_add_groups() and driver_remove_groups should take a constant pointer as the structure is not modified, so make the change.
Cc: Raf
driver core: driver: mark driver_add/remove_groups constant
driver_add_groups() and driver_remove_groups should take a constant pointer as the structure is not modified, so make the change.
Cc: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.10-rc3, v6.10-rc2, v6.10-rc1, v6.9, v6.9-rc7, v6.9-rc6, v6.9-rc5, v6.9-rc4 |
|
| #
85d2b0aa |
| 08-Apr-2024 |
Arnd Bergmann <[email protected]> |
module: don't ignore sysfs_create_link() failures
The sysfs_create_link() return code is marked as __must_check, but the module_add_driver() function tries hard to not care, by assigning the return
module: don't ignore sysfs_create_link() failures
The sysfs_create_link() return code is marked as __must_check, but the module_add_driver() function tries hard to not care, by assigning the return code to a variable. When building with 'make W=1', gcc still warns because this variable is only assigned but not used:
drivers/base/module.c: In function 'module_add_driver': drivers/base/module.c:36:6: warning: variable 'no_warn' set but not used [-Wunused-but-set-variable]
Rework the code to properly unwind and return the error code to the caller. My reading of the original code was that it tries to not fail when the links already exist, so keep ignoring -EEXIST errors.
Fixes: e17e0f51aeea ("Driver core: show drivers in /sys/module/") See-also: 4a7fb6363f2d ("add __must_check to device management code") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.9-rc3, v6.9-rc2, v6.9-rc1, v6.8 |
|
| #
f8c7511d |
| 05-Mar-2024 |
Ricardo B. Marliere <[email protected]> |
block: make block_class constant
Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move th
block: make block_class constant
Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the block_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.
Cc: Greg Kroah-Hartman <[email protected]> Suggested-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Ricardo B. Marliere <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
|
Revision tags: v6.8-rc7, v6.8-rc6, v6.8-rc5, v6.8-rc4, v6.8-rc3, v6.8-rc2, v6.8-rc1, v6.7, v6.7-rc8, v6.7-rc7, v6.7-rc6, v6.7-rc5, v6.7-rc4, v6.7-rc3, v6.7-rc2, v6.7-rc1, v6.6, v6.6-rc7, v6.6-rc6, v6.6-rc5, v6.6-rc4, v6.6-rc3, v6.6-rc2, v6.6-rc1, v6.5, v6.5-rc7, v6.5-rc6, v6.5-rc5, v6.5-rc4, v6.5-rc3, v6.5-rc2, v6.5-rc1, v6.4, v6.4-rc7, v6.4-rc6, v6.4-rc5, v6.4-rc4, v6.4-rc3, v6.4-rc2, v6.4-rc1, v6.3, v6.3-rc7, v6.3-rc6, v6.3-rc5 |
|
| #
43a7206b |
| 02-Apr-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: class: make class_register() take a const *
Now that the class code is cleaned up to not modify the class pointer registered with it, change class_register() to take a const * to allow
driver core: class: make class_register() take a const *
Now that the class code is cleaned up to not modify the class pointer registered with it, change class_register() to take a const * to allow the structure to be placed into read-only memory.
Acked-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/2023040248-customary-release-4aec@gregkh Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
980c0561 |
| 31-Mar-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: make sysfs_dev_char_kobj static
Nothing outside of drivers/base/core.c uses sysfs_dev_char_kobj, so make it static and document what it is used for so we remember it the next time we to
driver core: make sysfs_dev_char_kobj static
Nothing outside of drivers/base/core.c uses sysfs_dev_char_kobj, so make it static and document what it is used for so we remember it the next time we touch it 15 years from now.
Acked-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
d6bdbbdf |
| 31-Mar-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: clean up the logic to determine which /sys/dev/ directory to use
When a dev_t is set in a struct device, an symlink in /sys/dev/ is created for it either under /sys/dev/block/ or /sys/d
driver core: clean up the logic to determine which /sys/dev/ directory to use
When a dev_t is set in a struct device, an symlink in /sys/dev/ is created for it either under /sys/dev/block/ or /sys/dev/char/ depending on the device type.
The logic to determine this would trigger off of the class of the object, and the kobj_type set in that location. But it turns out that this deep nesting isn't needed at all, as it's either a choice of block or "everything else" which is a char device. So make the logic a lot more simple and obvious, and remove the incorrect comments in the code that tried to document something that was not happening at all (it is impossible to set class->dev_kobj to NULL as the class core prevented that from happening.
This removes the only place that class->dev_kobj was being used, so after this, it can be removed entirely.
Acked-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
7d90e81a |
| 31-Mar-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: core: move to use class_to_subsys()
There are a number of places in core.c that need access to the private subsystem structure of struct class, so move them to use class_to_subsys() ins
driver core: core: move to use class_to_subsys()
There are a number of places in core.c that need access to the private subsystem structure of struct class, so move them to use class_to_subsys() instead of accessing it directly.
This requires exporting class_to_subsys() out of class.c, but keeping it local to the driver core.
Reviewed-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
5c9a27df |
| 27-Mar-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: move sysfs_dev_char_kobj out of class.h
The structure sysfs_dev_char_kobj is local only to the driver core code, so move it out of the global class.h file and into the internal base.h f
driver core: move sysfs_dev_char_kobj out of class.h
The structure sysfs_dev_char_kobj is local only to the driver core code, so move it out of the global class.h file and into the internal base.h file as no one else should be touching this symbol.
Acked-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.3-rc4 |
|
| #
00945520 |
| 24-Mar-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: move documentation for lock_key to proper location.
In commit 37e98d9bedb5 ("driver core: bus: move lock_class_key into dynamic structure"), the lock_key variable moved out of stru
driver core: bus: move documentation for lock_key to proper location.
In commit 37e98d9bedb5 ("driver core: bus: move lock_class_key into dynamic structure"), the lock_key variable moved out of struct bus_type and into struct subsys_private, yet the documentation for it did not move. Fix that up and place the documentation comment in the correct location.
Cc: "Rafael J. Wysocki" <[email protected]> Fixes: 37e98d9bedb5 ("driver core: bus: move lock_class_key into dynamic structure") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
8da5b970 |
| 24-Mar-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: base.h: remove extern from function prototypes
The kernel coding style does not require 'extern' in function prototypes in .h files, so remove them from drivers/base/base.h as they are
driver core: base.h: remove extern from function prototypes
The kernel coding style does not require 'extern' in function prototypes in .h files, so remove them from drivers/base/base.h as they are not needed.
Acked-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.3-rc3 |
|
| #
00c4a3c4 |
| 13-Mar-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: constantify bus_register()
bus_register() is now safe to take a constant * to bus_type, so make that change and mark the subsys_private bus_type * constant as well.
Cc: "Rafael J.
driver core: bus: constantify bus_register()
bus_register() is now safe to take a constant * to bus_type, so make that change and mark the subsys_private bus_type * constant as well.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
9cc61e5f |
| 13-Mar-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: move dev_root out of struct bus_type
Now that all accesses of dev_root is through the bus_get_dev_root() call, move the pointer out of struct bus_type and into the private dynamic
driver core: bus: move dev_root out of struct bus_type
Now that all accesses of dev_root is through the bus_get_dev_root() call, move the pointer out of struct bus_type and into the private dynamic structure, subsys_private.
With this change, there is no modifiable portions of struct bus_type so it can be marked as a constant structure and moved to read-only memory.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.3-rc2, v6.3-rc1 |
|
| #
f8fb5766 |
| 04-Mar-2023 |
Saravana Kannan <[email protected]> |
driver core: Make state_synced device attribute writeable
If the file is written to and sync_state() hasn't been called for the device yet, then call sync_state() for the device independent of the s
driver core: Make state_synced device attribute writeable
If the file is written to and sync_state() hasn't been called for the device yet, then call sync_state() for the device independent of the state of its consumers.
This is useful for supplier devices that have one or more consumers that don't have a driver but the consumers are in a state that don't use the resources supplied by the supplier device.
This gives finer grained control than using the fw_devlink.sync_state=timeout kernel commandline parameter.
Signed-off-by: Saravana Kannan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|