|
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 ...
|
|
Revision tags: v6.14-rc6, v6.14-rc5, v6.14-rc4, v6.14-rc3, v6.14-rc2 |
|
| #
6fb1ee25 |
| 03-Feb-2025 |
Bharadwaj Raju <[email protected]> |
drivers/base/bus.c: fix spelling of "subsystem"
Fix spelling, "subystem" -> "subsystem"
Signed-off-by: Bharadwaj Raju <[email protected]> Link: https://lore.kernel.org/r/20250203220312.10
drivers/base/bus.c: fix spelling of "subsystem"
Fix spelling, "subystem" -> "subsystem"
Signed-off-by: Bharadwaj Raju <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6 |
|
| #
767b74e0 |
| 05-Jan-2025 |
Zijun Hu <[email protected]> |
driver core: Introduce device_iter_t for device iterating APIs
There are several for_each APIs which has parameter with type below: int (*fn)(struct device *dev, void *data) They iterate over variou
driver core: Introduce device_iter_t for device iterating APIs
There are several for_each APIs which has parameter with type below: int (*fn)(struct device *dev, void *data) They iterate over various device lists and call @fn() for each device with caller provided data @*data, and they usually need to modify @*data.
Give the type an dedicated typedef with advantages shown below: typedef int (*device_iter_t)(struct device *dev, void *data)
- Shorter API declarations and definitions - Prevent further for_each APIs from using bad parameter type
So introduce device_iter_t and apply it to various existing APIs below: bus_for_each_dev() (class|driver)_for_each_device() device_for_each_child(_reverse|_reverse_from)().
Reviewed-by: Jonathan Cameron <[email protected]> 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 ...
|
| #
3f58ee54 |
| 05-Jan-2025 |
Zijun Hu <[email protected]> |
driver core: Move true expression out of if condition in 3 device finding APIs
For bus_find_device(), driver_find_device(), and device_find_child(), all of their function body have pattern below:
{
driver core: Move true expression out of if condition in 3 device finding APIs
For bus_find_device(), driver_find_device(), and device_find_child(), all of their function body have pattern below:
{ struct klist_iter i; struct device *dev;
... while ((dev = next_device(&i))) if (match(dev, data) && get_device(dev)) break; ... }
The expression 'get_device(dev)' in the if condition always returns true since @dev != NULL.
Move the expression to if body to make logic of these APIs more clearer.
Reviewed-by: Fan Ni <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> 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.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, v6.11, v6.11-rc7, v6.11-rc6, v6.11-rc5, v6.11-rc4 |
|
| #
b45ed06f |
| 13-Aug-2024 |
Zijun Hu <[email protected]> |
drivers/base: Introduce device_match_t for device finding APIs
There are several drivers/base APIs for finding a specific device, and they currently use the following good type for the @match parame
drivers/base: Introduce device_match_t for device finding APIs
There are several drivers/base APIs for finding a specific device, and they currently use the following good type for the @match parameter: int (*match)(struct device *dev, const void *data)
Since these operations do not modify the caller-provided @*data, this type is worthy of a dedicated typedef: typedef int (*device_match_t)(struct device *dev, const void *data)
Advantages of using device_match_t: - Shorter API declarations and definitions - Prevent further APIs from using a bad type for @match
So introduce device_match_t and apply it to the existing (bus|class|driver|auxiliary)_find_device() APIs.
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.11-rc3, v6.11-rc2, v6.11-rc1 |
|
| #
bfa54a79 |
| 27-Jul-2024 |
Zijun Hu <[email protected]> |
driver core: bus: Fix double free in driver API bus_register()
For bus_register(), any error which happens after kset_register() will cause that @priv are freed twice, fixed by setting @priv with NU
driver core: bus: Fix double free in driver API bus_register()
For bus_register(), any error which happens after kset_register() will cause that @priv are freed twice, fixed by setting @priv with NULL after the first free.
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 ...
|
| #
2bdf3b83 |
| 27-Jul-2024 |
Zijun Hu <[email protected]> |
driver core: bus: Add simple error handling for buses_init()
Add simple error handling for buses_init() since it is easy to do.
Signed-off-by: Zijun Hu <[email protected]> Link: https://lore.
driver core: bus: Add simple error handling for buses_init()
Add simple error handling for buses_init() since it is easy to do.
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 ...
|
| #
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 ...
|
| #
c0fd973c |
| 24-Jul-2024 |
Zijun Hu <[email protected]> |
driver core: bus: Return -EIO instead of 0 when show/store invalid bus attribute
Return -EIO instead of 0 for below erroneous bus attribute operations: - read a bus attribute without show(). - wri
driver core: bus: Return -EIO instead of 0 when show/store invalid bus attribute
Return -EIO instead of 0 for below erroneous bus attribute operations: - read a bus attribute without show(). - write a bus attribute without store().
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, v6.10-rc7, v6.10-rc6, v6.10-rc5, v6.10-rc4, 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, 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 |
|
| #
32f78abe |
| 19-Dec-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: constantify subsys_register() calls
The functions subsys_register() and subsys_virtual_register() should be taking a constant pointer to a struct bus_type, as they do not actually
driver core: bus: constantify subsys_register() calls
The functions subsys_register() and subsys_virtual_register() should be taking a constant pointer to a struct bus_type, as they do not actually modify anything in it, so fix up the function definitions to do so properly.
This also changes the pointer type in struct subsys_interface to be constant as well, as again, that's the proper signature of it.
Cc: Rafael J. Wysocki <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/2023121908-grove-genetics-f8af@gregkh Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
5ae81209 |
| 19-Dec-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: make bus_sort_breadthfirst() take a const pointer
For some reason, during the big "clean up the driver core for a const struct bus_type" work, the bus_sort_breadthfirst() call was
driver core: bus: make bus_sort_breadthfirst() take a const pointer
For some reason, during the big "clean up the driver core for a const struct bus_type" work, the bus_sort_breadthfirst() call was missed. Fix this up by changing the type to be a const * as it should be.
Cc: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/2023121935-stinking-ditzy-fd5d@gregkh Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: 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, v6.3-rc4, v6.3-rc3 |
|
| #
38370c4e |
| 13-Mar-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: constify bus_get()
It's funny to think about getting a reference count of a constant structure pointer, but this locks into place the private data "underneath" the struct bus_type(
driver core: bus: constify bus_get()
It's funny to think about getting a reference count of a constant structure pointer, but this locks into place the private data "underneath" the struct bus_type() which is important to not go away while we are working with the bus structure for some callbacks.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
7c06be04 |
| 13-Mar-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: constify driver_find()
The driver_find() function can now take a const * to bus_type, not just a * so fix that up.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.k
driver core: bus: constify driver_find()
The driver_find() function can now take a const * to bus_type, not just a * so fix that up.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
9622b9f2 |
| 13-Mar-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: constify bus_rescan_devices()
The bus_rescan_devices() function was missed in the previous change of the bus_for_each* constant pointer changes, so fix it up now to take a const *
driver core: bus: constify bus_rescan_devices()
The bus_rescan_devices() function was missed in the previous change of the bus_for_each* constant pointer changes, so fix it up now to take a const * to struct bus_type.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
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 ...
|
| #
75cff725 |
| 13-Mar-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: mark the struct bus_type for sysfs callbacks as constant
struct bus_type should never be modified in a sysfs callback as there is nothing in the structure to modify, and frankly, t
driver core: bus: mark the struct bus_type for sysfs callbacks as constant
struct bus_type should never be modified in a sysfs callback as there is nothing in the structure to modify, and frankly, the structure is almost never used in a sysfs callback, so mark it as constant to allow struct bus_type to be moved to read-only memory.
Cc: "David S. Miller" <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Cc: "K. Y. Srinivasan" <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Alexandre Bounine <[email protected]> Cc: Alison Schofield <[email protected]> Cc: Ben Widawsky <[email protected]> Cc: Dexuan Cui <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Haiyang Zhang <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Harald Freudenberger <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Hu Haowen <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Laurentiu Tudor <[email protected]> Cc: Matt Porter <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Stuart Yoder <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Vishal Verma <[email protected]> Cc: Yanteng Si <[email protected]> Acked-by: Ilya Dryomov <[email protected]> # rbd Acked-by: Ira Weiny <[email protected]> # cxl Reviewed-by: Alex Shi <[email protected]> Acked-by: Iwona Winiarska <[email protected]> Acked-by: Dan Williams <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> # pci Acked-by: Wei Liu <[email protected]> Acked-by: Martin K. Petersen <[email protected]> # scsi 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 |
|
| #
e8b812b3 |
| 21-Feb-2023 |
Geert Uytterhoeven <[email protected]> |
driver core: bus: Handle early calls to bus_to_subsys()
When calling soc_device_match() from early_initcall(), bus_kset is still NULL, causing a crash:
Unable to handle kernel NULL pointer dere
driver core: bus: Handle early calls to bus_to_subsys()
When calling soc_device_match() from early_initcall(), bus_kset is still NULL, causing a crash:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000028 ... Call trace: __lock_acquire+0x530/0x20f0 lock_acquire.part.0+0xc8/0x210 lock_acquire+0x64/0x80 _raw_spin_lock+0x4c/0x60 bus_to_subsys+0x24/0xac bus_for_each_dev+0x30/0xcc soc_device_match+0x4c/0xe0 r8a7795_sysc_init+0x18/0x60 rcar_sysc_pd_init+0xb0/0x33c do_one_initcall+0x128/0x2bc
Before, bus_for_each_dev() handled this gracefully by checking that the back-pointer to the private structure was valid.
Fix this by adding a NULL check for bus_kset to bus_to_subsys().
Fixes: 83b9148df2c95e23 ("driver core: bus: bus iterator cleanups") Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/0a92979f6e790737544638e8a4c19b0564e660a2.1676983596.git.geert+renesas@glider.be Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.2, v6.2-rc8 |
|
| #
ccfc901f |
| 10-Feb-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: update my copyright notice
There's been some work done recently to the drivers/base/bus.c file so update the copyright notice in it to make those who track those types of things ha
driver core: bus: update my copyright notice
There's been some work done recently to the drivers/base/bus.c file so update the copyright notice in it to make those who track those types of things have an easier job.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
8c99377e |
| 09-Feb-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: add bus_get_dev_root() function
Instead of poking around in the struct bus_type directly for the dev_root pointer, provide a function to return it properly reference counted, if it
driver core: bus: add bus_get_dev_root() function
Instead of poking around in the struct bus_type directly for the dev_root pointer, provide a function to return it properly reference counted, if it is present in the bus. This will be needed to move the pointer out of struct bus_type in the future.
Use the function in the driver core code at the same time it is introduced to verify that it works 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 ...
|
| #
ad8685d0 |
| 08-Feb-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: constify bus_unregister()
The bus_unregister() function can now take a const * to bus_type, not just a * so fix that up.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://
driver core: bus: constify bus_unregister()
The bus_unregister() function can now take a const * to bus_type, not just a * so fix that up.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
4dd1f3f8 |
| 08-Feb-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: constify some internal functions
The functions add_probe_files() and remove_probe_files() should be taking a const * to bus_type, not just a *, so fix that up. These functions sho
driver core: bus: constify some internal functions
The functions add_probe_files() and remove_probe_files() should be taking a const * to bus_type, not just a *, so fix that up. These functions should really be removed entirely and an attribute group used instead, but for now, make this change so that other const work can continue.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
f91482be |
| 08-Feb-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: constify bus_get_kset()
The bus_get_kset() function should be taking a const * to bus_type, not just a * so fix that up.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://
driver core: bus: constify bus_get_kset()
The bus_get_kset() function should be taking a const * to bus_type, not just a * so fix that up.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
bc8b7931 |
| 08-Feb-2023 |
Greg Kroah-Hartman <[email protected]> |
driver core: bus: constify bus_register/unregister_notifier()
The bus_register_notifier() and bus_unregister_notifier() functions should be taking a const * to bus_type, not just a * so fix that up.
driver core: bus: constify bus_register/unregister_notifier()
The bus_register_notifier() and bus_unregister_notifier() functions should be taking a const * to bus_type, not just a * so fix that up.
Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|