From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Prarit Bhargava <prarit@redhat.com>,
Len Brown <len.brown@intel.com>, Sasha Levin <sashal@kernel.org>,
linux-pm@vger.kernel.org
Subject: [PATCH AUTOSEL 5.2 82/94] tools/power turbostat: fix file descriptor leaks
Date: Wed, 4 Sep 2019 11:57:27 -0400 [thread overview]
Message-ID: <20190904155739.2816-82-sashal@kernel.org> (raw)
In-Reply-To: <20190904155739.2816-1-sashal@kernel.org>
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
[ Upstream commit 605736c6929d541c78a85dffae4d33a23b6b2149 ]
Fix file descriptor leaks by closing fp before return.
Addresses-Coverity-ID: 1444591 ("Resource leak")
Addresses-Coverity-ID: 1444592 ("Resource leak")
Fixes: 5ea7647b333f ("tools/power turbostat: Warn on bad ACPI LPIT data")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/power/x86/turbostat/turbostat.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 71a931813de00..066bd43ed6c9f 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -2912,6 +2912,7 @@ int snapshot_cpu_lpi_us(void)
if (retval != 1) {
fprintf(stderr, "Disabling Low Power Idle CPU output\n");
BIC_NOT_PRESENT(BIC_CPU_LPI);
+ fclose(fp);
return -1;
}
--
2.20.1
next prev parent reply other threads:[~2019-09-04 15:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190904155739.2816-1-sashal@kernel.org>
2019-09-04 15:57 ` [PATCH AUTOSEL 5.2 81/94] tools/power turbostat: fix leak of file descriptor on error return path Sasha Levin
2019-09-04 15:57 ` Sasha Levin [this message]
2019-09-05 17:00 ` [PATCH AUTOSEL 5.2 82/94] tools/power turbostat: fix file descriptor leaks Brown, Len
2019-09-04 15:57 ` [PATCH AUTOSEL 5.2 83/94] tools/power turbostat: fix buffer overrun Sasha Levin
2019-09-04 15:57 ` [PATCH AUTOSEL 5.2 84/94] tools/power turbostat: Fix Haswell Core systems Sasha Levin
2019-09-04 15:57 ` [PATCH AUTOSEL 5.2 85/94] tools/power turbostat: Add Ice Lake NNPI support Sasha Levin
2019-09-04 15:57 ` [PATCH AUTOSEL 5.2 86/94] tools/power turbostat: Fix CPU%C1 display value Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190904155739.2816-82-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=gustavo@embeddedor.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=prarit@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).