From patchwork Tue Nov 22 08:53:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 13052074 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CC21C433FE for ; Tue, 22 Nov 2022 09:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233084AbiKVJI5 (ORCPT ); Tue, 22 Nov 2022 04:08:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233242AbiKVJIk (ORCPT ); Tue, 22 Nov 2022 04:08:40 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6848831FBE for ; Tue, 22 Nov 2022 01:08:39 -0800 (PST) Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NGdcW3VtTzqSWN; Tue, 22 Nov 2022 17:04:43 +0800 (CST) Received: from dggpemm500002.china.huawei.com (7.185.36.229) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 22 Nov 2022 17:08:37 +0800 Received: from linux-ibm.site (10.175.102.37) by dggpemm500002.china.huawei.com (7.185.36.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 22 Nov 2022 17:08:37 +0800 From: Hanjun Guo To: "Rafael J. Wysocki" CC: , Srinivas Pandruvada , Hanjun Guo Subject: [PATCH] ACPI: fan: Bail out if extract package failed Date: Tue, 22 Nov 2022 16:53:28 +0800 Message-ID: <1669107208-16226-1-git-send-email-guohanjun@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500002.china.huawei.com (7.185.36.229) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 --- 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];