Skip to content

Commit

Permalink
net: wwan: iosm: fix memory leak in ipc_pcie_read_bios_cfg
Browse files Browse the repository at this point in the history
ipc_pcie_read_bios_cfg() is using the acpi_evaluate_dsm() to
obtain the wwan power state configuration from BIOS but is
not freeing the acpi_object. The acpi_evaluate_dsm() returned
acpi_object to be freed.

Free the acpi_object after use.

Fixes: 7e98d78 ("net: iosm: entry point")
Signed-off-by: M Chetan Kumar <m.chetan.kumar@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
M Chetan Kumar authored and David S. Miller committed Nov 9, 2022
1 parent 742c60e commit d38a648
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/net/wwan/iosm/iosm_ipc_pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ static void ipc_pcie_config_init(struct iosm_pcie *ipc_pcie)
*/
static enum ipc_pcie_sleep_state ipc_pcie_read_bios_cfg(struct device *dev)
{
enum ipc_pcie_sleep_state sleep_state = IPC_PCIE_D0L12;
union acpi_object *object;
acpi_handle handle_acpi;

Expand All @@ -242,12 +243,16 @@ static enum ipc_pcie_sleep_state ipc_pcie_read_bios_cfg(struct device *dev)
}

object = acpi_evaluate_dsm(handle_acpi, &wwan_acpi_guid, 0, 3, NULL);
if (!object)
goto default_ret;

if (object->integer.value == 3)
sleep_state = IPC_PCIE_D3L2;

if (object && object->integer.value == 3)
return IPC_PCIE_D3L2;
kfree(object);

default_ret:
return IPC_PCIE_D0L12;
return sleep_state;
}

static int ipc_pcie_probe(struct pci_dev *pci,
Expand Down

0 comments on commit d38a648

Please sign in to comment.