mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-20 03:04:01 +08:00
ARM64: hisi: SoC driver updates for 5.7
- Fix up the device resources for the broken firmware to avoid use-after-free warnings from KASAN in the host removal path -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJeYfUQAAoJEAvIV27ZiWZcXsUP/0vsuQSXiEzgRTYoKRVxDaSy NIwVG+ZvsJXyIO4C/7d8GwHGuL+bhUDc5GCluLHGo9lM7fmuFHWTw5IpYsEeBv04 r7DLt3Gu1Ka9pIEUQCwhVqM1y/yldrahiYlnSX8KD5Kk2nASCuvgCNwvcyuPqPZA fyOUGHpeBlSULXMItGcH4mlApXaLh9HzU4DcAJnyflqOhsQKhyGvoi97KeTLx/TM bGVmFLUJY6tDAm4rAUz5qCljhuMieQDWnFwZV5kr6Udy8TxoC4uJQp+6oFwyzRPh RRt/P9/t/y51CfFDlX8woA5YoVQEFB1DbGBB9GfDfvhzLTT8vhTYaPty/dMLPGs/ WfPvgWmxBI7PqYwNlAIU1sxp/leC4OdIxINM61lBKNWsT6pbtCexCwfgUXar9/bn OMMHTybtYH9jdDkAoVk5+v5g2Ca9Ao6hfi2PJUW7g4CkVVMlItmpA5op3qDqEs8T OtHOld3B0dMnG6cJbqlc5w+uAQUlwIybgkXlOzrx6krYKW3p2MpJzgX8zb4ArBzj L+xgITIVEKbgd4a9bk6v2xczCi+QfD+xuzyVEvc01ejBcj4Vkw5OLRnxOeZ4/msE fLXEY82//OoAYbb07KUGH7GvriVdYHazXJ2C0ssAprII+pSFSKv2onNKjrSwAHgI MJX6cny9uEvRZ2oJ4t9M =hIMK -----END PGP SIGNATURE----- Merge tag 'hisi-drivers-for-5.7' of git://github.com/hisilicon/linux-hisi into arm/drivers ARM64: hisi: SoC driver updates for 5.7 - Fix up the device resources for the broken firmware to avoid use-after-free warnings from KASAN in the host removal path * tag 'hisi-drivers-for-5.7' of git://github.com/hisilicon/linux-hisi: bus: hisi_lpc: Fixup IO ports addresses to avoid use-after-free in host removal Link: https://lore.kernel.org/r/5E61F700.5060301@hisilicon.com Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
commit
5fc0458767
@ -357,6 +357,26 @@ static int hisi_lpc_acpi_xlat_io_res(struct acpi_device *adev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Released firmware describes the IO port max address as 0x3fff, which is
|
||||
* the max host bus address. Fixup to a proper range. This will probably
|
||||
* never be fixed in firmware.
|
||||
*/
|
||||
static void hisi_lpc_acpi_fixup_child_resource(struct device *hostdev,
|
||||
struct resource *r)
|
||||
{
|
||||
if (r->end != 0x3fff)
|
||||
return;
|
||||
|
||||
if (r->start == 0xe4)
|
||||
r->end = 0xe4 + 0x04 - 1;
|
||||
else if (r->start == 0x2f8)
|
||||
r->end = 0x2f8 + 0x08 - 1;
|
||||
else
|
||||
dev_warn(hostdev, "unrecognised resource %pR to fixup, ignoring\n",
|
||||
r);
|
||||
}
|
||||
|
||||
/*
|
||||
* hisi_lpc_acpi_set_io_res - set the resources for a child
|
||||
* @child: the device node to be updated the I/O resource
|
||||
@ -418,8 +438,11 @@ static int hisi_lpc_acpi_set_io_res(struct device *child,
|
||||
return -ENOMEM;
|
||||
}
|
||||
count = 0;
|
||||
list_for_each_entry(rentry, &resource_list, node)
|
||||
resources[count++] = *rentry->res;
|
||||
list_for_each_entry(rentry, &resource_list, node) {
|
||||
resources[count] = *rentry->res;
|
||||
hisi_lpc_acpi_fixup_child_resource(hostdev, &resources[count]);
|
||||
count++;
|
||||
}
|
||||
|
||||
acpi_dev_free_resource_list(&resource_list);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user