Commit e7de4b49 authored by Dan Carpenter's avatar Dan Carpenter Committed by Felix Fietkau

wifi: mt76: mt7921: fix use after free in mt7921_acpi_read()

Don't dereference "sar_root" after it has been freed.

Fixes: f965333e ("mt76: mt7921: introduce ACPI SAR support")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent b5ee771c
...@@ -13,6 +13,7 @@ mt7921_acpi_read(struct mt7921_dev *dev, u8 *method, u8 **tbl, u32 *len) ...@@ -13,6 +13,7 @@ mt7921_acpi_read(struct mt7921_dev *dev, u8 *method, u8 **tbl, u32 *len)
acpi_handle root, handle; acpi_handle root, handle;
acpi_status status; acpi_status status;
u32 i = 0; u32 i = 0;
int ret;
root = ACPI_HANDLE(mdev->dev); root = ACPI_HANDLE(mdev->dev);
if (!root) if (!root)
...@@ -52,9 +53,11 @@ mt7921_acpi_read(struct mt7921_dev *dev, u8 *method, u8 **tbl, u32 *len) ...@@ -52,9 +53,11 @@ mt7921_acpi_read(struct mt7921_dev *dev, u8 *method, u8 **tbl, u32 *len)
*(*tbl + i) = (u8)sar_unit->integer.value; *(*tbl + i) = (u8)sar_unit->integer.value;
} }
free: free:
ret = (i == sar_root->package.count) ? 0 : -EINVAL;
kfree(sar_root); kfree(sar_root);
return (i == sar_root->package.count) ? 0 : -EINVAL; return ret;
} }
/* MTCL : Country List Table for 6G band */ /* MTCL : Country List Table for 6G band */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment