title: spmi: mediatek: Fix UAF on device remove
description: In the Linux kernel, the following vulnerability has been resolved:
spmi: mediatek: Fix UAF on device remove
The pmif driver data that contains the clocks is allocated along with
spmi_controller.
On device remove, spmi_controller will be freed first, and then devres
, including the clocks, will be cleanup.
This leads to UAF because putting the clocks will access the clocks in
the pmif driver data, which is already freed along with spmi_controller.
This can be reproduced by enabling DEBUG_TEST_DRIVER_REMOVE and
building the kernel with KASAN.
Fix the UAF issue by using unmanaged clk_bulk_get() and putting the
clocks before freeing spmi_controller.
affected:
{
product: Linux
vendor: Linux
defaultStatus: unaffected
repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
versions:
version: 1da177e4c3f4, lessThan: 521f28eedd6b, status: affected, versionType: git
version: 1da177e4c3f4, lessThan: f8dcafcb5463, status: affected, versionType: git
version: 1da177e4c3f4, lessThan: 9a3881b1f07d, status: affected, versionType: git
version: 1da177e4c3f4, lessThan: e821d50ab5b9, status: affected, versionType: git
}
{
product: Linux
vendor: Linux
defaultStatus: affected
repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
versions:
version: 6.1.77, lessThanOrEqual: 6.1.*, status: unaffected, versionType: custom
version: 6.6.16, lessThanOrEqual: 6.6.*, status: unaffected, versionType: custom
version: 6.7.4, lessThanOrEqual: 6.7.*, status: unaffected, versionType: custom
version: 6.8, lessThanOrEqual: *, status: unaffected, versionType: original_commit_for_fix
}
