]> git.baikalelectronics.ru Git - kernel.git/commit
driver core: platform: use the correct callback type for bus_find_device
authorSami Tolvanen <samitolvanen@google.com>
Tue, 12 Nov 2019 21:41:56 +0000 (13:41 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Nov 2019 03:30:56 +0000 (11:30 +0800)
commit8c33c37f3d9bc75eebfd78939a29bdc63a8532d8
tree9fea500a88e461c48bfde7adf62de86ef8afdb4c
parent0fdd4ab21ad63d5e03dc29ba697cfa41a65865e9
driver core: platform: use the correct callback type for bus_find_device

platform_find_device_by_driver calls bus_find_device and passes
platform_match as the callback function. Casting the function to a
mismatching type trips indirect call Control-Flow Integrity (CFI) checking.

This change adds a callback function with the correct type and instead
of casting the function, explicitly casts the second parameter to struct
device_driver* as expected by platform_match.

Fixes: d6276367f3be4 ("platform: Add platform_find_device_by_driver() helper")
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191112214156.3430-1-samitolvanen@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/platform.c