mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
Drivers: hv: vmbus: Check ACPI companion before use
Platform drivers can be forced to bind to devices outside their match
tables through driver_override. vmbus_acpi_add() assumes that every bound
device has an ACPI companion and dereferences it without checking.
Return -ENODEV when the companion is absent to avoid a NULL pointer
dereference.
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Fixes: 9c84342380 ("Drivers: hv: vmbus: Convert acpi_device to more generic platform_device")
Reviewed-by: Naman Jain <namjain@linux.microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
This commit is contained in:
parent
6eb81a2a06
commit
dd57772e36
|
|
@ -2571,10 +2571,14 @@ EXPORT_SYMBOL_GPL(vmbus_free_mmio);
|
|||
#ifdef CONFIG_ACPI
|
||||
static int vmbus_acpi_add(struct platform_device *pdev)
|
||||
{
|
||||
struct acpi_device *ancestor;
|
||||
struct acpi_device *device;
|
||||
acpi_status result;
|
||||
int ret_val = -ENODEV;
|
||||
struct acpi_device *ancestor;
|
||||
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
|
||||
|
||||
device = ACPI_COMPANION(&pdev->dev);
|
||||
if (!device)
|
||||
return -ENODEV;
|
||||
|
||||
vmbus_root_device = &device->dev;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user