mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 10:57:46 +00:00
x86/amd-iommu: Fix 3 possible endless loops
The driver contains several loops counting on an u16 value where the exit-condition is checked against variables that can have values up to 0xffff. In this case the loops will never exit. This patch fixed 3 such loops. Cc: stable@kernel.org Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
This commit is contained in:
parent
59c5f46fbe
commit
0de66d5b35
1 changed files with 4 additions and 4 deletions
|
@ -731,8 +731,8 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu,
|
||||||
{
|
{
|
||||||
u8 *p = (u8 *)h;
|
u8 *p = (u8 *)h;
|
||||||
u8 *end = p, flags = 0;
|
u8 *end = p, flags = 0;
|
||||||
u16 dev_i, devid = 0, devid_start = 0, devid_to = 0;
|
u16 devid = 0, devid_start = 0, devid_to = 0;
|
||||||
u32 ext_flags = 0;
|
u32 dev_i, ext_flags = 0;
|
||||||
bool alias = false;
|
bool alias = false;
|
||||||
struct ivhd_entry *e;
|
struct ivhd_entry *e;
|
||||||
|
|
||||||
|
@ -887,7 +887,7 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu,
|
||||||
/* Initializes the device->iommu mapping for the driver */
|
/* Initializes the device->iommu mapping for the driver */
|
||||||
static int __init init_iommu_devices(struct amd_iommu *iommu)
|
static int __init init_iommu_devices(struct amd_iommu *iommu)
|
||||||
{
|
{
|
||||||
u16 i;
|
u32 i;
|
||||||
|
|
||||||
for (i = iommu->first_device; i <= iommu->last_device; ++i)
|
for (i = iommu->first_device; i <= iommu->last_device; ++i)
|
||||||
set_iommu_for_device(iommu, i);
|
set_iommu_for_device(iommu, i);
|
||||||
|
@ -1177,7 +1177,7 @@ static int __init init_memory_definitions(struct acpi_table_header *table)
|
||||||
*/
|
*/
|
||||||
static void init_device_table(void)
|
static void init_device_table(void)
|
||||||
{
|
{
|
||||||
u16 devid;
|
u32 devid;
|
||||||
|
|
||||||
for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) {
|
for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) {
|
||||||
set_dev_entry_bit(devid, DEV_ENTRY_VALID);
|
set_dev_entry_bit(devid, DEV_ENTRY_VALID);
|
||||||
|
|
Loading…
Reference in a new issue