Received: by 10.192.165.156 with SMTP id m28csp23751imm; Tue, 10 Apr 2018 15:35:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Py1ALi6zd/zdMRKwYZ+F/VtCYRWmzvdtXXVWQS3CzwqCHUYyUSFue7NXc1/5TrWMbMvuG X-Received: by 2002:a17:902:76c7:: with SMTP id j7-v6mr2323755plt.108.1523399751685; Tue, 10 Apr 2018 15:35:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523399751; cv=none; d=google.com; s=arc-20160816; b=U9YOy3Rc/khvefkt4E4vU5rW9EOhESQgC+ERVMMVpGcLRTg7eR7GxyDt5rgiAZcTXl 6xiR13m8lylUU1Rc0CowEK6cYPIUoX2XMOooYuGt5ySBhut0ewkqMhUY8cH1mpSH9FpZ PaAVQYVDciIFKMzu/XV++eleJCxsCcnQgP76bs/FnaTgVqVM5BxIdQ4wPkkNHQtRu8RQ JERv8UmYf2/mBIL1+P0GS5jiuDDaqg/EjGX9cr7tvptF/od7EA8BP7YKOX8THI142F9N Z9Ac3zHQIGl3rgzFMqB/Y2fw3Sxafi/dx87Ae8KwbLX+Nd4rQrws+jS/FBSxhGm/y+np yC2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=3n3QSK4scBF3Nw5sHp7ENK6ZjByNYI5IIJOlbiOubog=; b=MWe8e5PaKNXSXh7Mnzh3uZhikBsPMOlB64eepWSnxDP3t0xfwW4hUmfgQKw7WfXzWw B+EVEYO4gYXzTyo859fURWwiMR0tB5ImLeq9OYy4mWHkQT6fEdbGMgTBsh5XDcCT+5vd SvnDP/WbJrbon4UF6up/Y15QP/kUXNgHIVNqs6DGopjTnFPodfvNaj1/iaCj3ROxbR3+ G7y7I1xvROyHARCdbIUxu/j4EDrzNkGv6S1aaVOfhO+1hFIOz2qA5USrq9Jl3kpR78w3 v36DV9iXQIxfV1P2kOz9thQ+YcW6qrmH9jHi+M5Xym8b/kFjQjjmmArB5oyuoak8AefA FYWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si2479520pgn.648.2018.04.10.15.35.14; Tue, 10 Apr 2018 15:35:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754620AbeDJWag (ORCPT + 99 others); Tue, 10 Apr 2018 18:30:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40034 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752785AbeDJWaf (ORCPT ); Tue, 10 Apr 2018 18:30:35 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3F53ADE6; Tue, 10 Apr 2018 22:30:34 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Khoroshilov , Zhang Rui , Sasha Levin Subject: [PATCH 4.15 106/168] thermal: int3400_thermal: fix error handling in int3400_thermal_probe() Date: Wed, 11 Apr 2018 00:24:08 +0200 Message-Id: <20180410212804.749830383@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexey Khoroshilov [ Upstream commit 0be86969ae385c5c944286bd9f66068525de15ee ] There are resources that are not dealocated on failure path in int3400_thermal_probe(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: Zhang Rui Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/thermal/int340x_thermal/int3400_thermal.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/drivers/thermal/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/int340x_thermal/int3400_thermal.c @@ -319,17 +319,21 @@ static int int3400_thermal_probe(struct result = sysfs_create_group(&pdev->dev.kobj, &uuid_attribute_group); if (result) - goto free_zone; + goto free_rel_misc; result = acpi_install_notify_handler( priv->adev->handle, ACPI_DEVICE_NOTIFY, int3400_notify, (void *)priv); if (result) - goto free_zone; + goto free_sysfs; return 0; -free_zone: +free_sysfs: + sysfs_remove_group(&pdev->dev.kobj, &uuid_attribute_group); +free_rel_misc: + if (!priv->rel_misc_dev_res) + acpi_thermal_rel_misc_device_remove(priv->adev->handle); thermal_zone_device_unregister(priv->thermal); free_art_trt: kfree(priv->trts);