diff mbox series

ACPI: fan: Bail out if extract package failed

Message ID 1669107208-16226-1-git-send-email-guohanjun@huawei.com (mailing list archive)
State Mainlined, archived
Headers show
Series ACPI: fan: Bail out if extract package failed | expand

Commit Message

Hanjun Guo Nov. 22, 2022, 8:53 a.m. UTC
Bail out if we extract the _FIF package failed, or we will end
of referencing the garbage information in fields[], the fan control
will be in mess, fix it.

Fiexes: d445571fa369 ("ACPI: fan: Optimize struct acpi_fan_fif")
Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
---
 drivers/acpi/fan_core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Rafael J. Wysocki Nov. 23, 2022, 6:33 p.m. UTC | #1
On Tue, Nov 22, 2022 at 10:08 AM Hanjun Guo <guohanjun@huawei.com> wrote:
>
> Bail out if we extract the _FIF package failed, or we will end
> of referencing the garbage information in fields[], the fan control
> will be in mess, fix it.
>
> Fiexes: d445571fa369 ("ACPI: fan: Optimize struct acpi_fan_fif")
> Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
> ---
>  drivers/acpi/fan_core.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/acpi/fan_core.c b/drivers/acpi/fan_core.c
> index 52a0b30..9dccbae 100644
> --- a/drivers/acpi/fan_core.c
> +++ b/drivers/acpi/fan_core.c
> @@ -236,6 +236,7 @@ static int acpi_fan_get_fif(struct acpi_device *device)
>         if (ACPI_FAILURE(status)) {
>                 dev_err(&device->dev, "Invalid _FIF element\n");
>                 status = -EINVAL;
> +               goto err;
>         }
>
>         fan->fif.revision = fields[0];
> --

Applied as 6.2 material, thanks!
diff mbox series

Patch

diff --git a/drivers/acpi/fan_core.c b/drivers/acpi/fan_core.c
index 52a0b30..9dccbae 100644
--- a/drivers/acpi/fan_core.c
+++ b/drivers/acpi/fan_core.c
@@ -236,6 +236,7 @@  static int acpi_fan_get_fif(struct acpi_device *device)
 	if (ACPI_FAILURE(status)) {
 		dev_err(&device->dev, "Invalid _FIF element\n");
 		status = -EINVAL;
+		goto err;
 	}
 
 	fan->fif.revision = fields[0];