iio: inv_mpu6050: Fix use-after-free in ACPI code
In some cases this can result in incorrectly returning a negative value from asus_acpi_get_sensor_info and the AK8963 magnetometer failing to show up. Note cpm is an alias for buffer.pointer which isn't apparent in this patch on it's own. Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com> Acked-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Родитель
a9cc400615
Коммит
6e85dbe4b4
|
@ -56,6 +56,7 @@ static int asus_acpi_get_sensor_info(struct acpi_device *adev,
|
||||||
int i;
|
int i;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_object *cpm;
|
union acpi_object *cpm;
|
||||||
|
int ret;
|
||||||
|
|
||||||
status = acpi_evaluate_object(adev->handle, "CNF0", NULL, &buffer);
|
status = acpi_evaluate_object(adev->handle, "CNF0", NULL, &buffer);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
|
@ -82,10 +83,10 @@ static int asus_acpi_get_sensor_info(struct acpi_device *adev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ret = cpm->package.count;
|
||||||
kfree(buffer.pointer);
|
kfree(buffer.pointer);
|
||||||
|
|
||||||
return cpm->package.count;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_i2c_check_resource(struct acpi_resource *ares, void *data)
|
static int acpi_i2c_check_resource(struct acpi_resource *ares, void *data)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче