!4 fix file descriptor leak in ras-report.c:setup_report_socket()

Merge pull request !4 from chengquan/developer
This commit is contained in:
openeuler-ci-bot 2020-03-18 15:55:01 +08:00 committed by Gitee
commit 08ff7b8dc5
2 changed files with 52 additions and 9 deletions

View File

@ -0,0 +1,37 @@
From 4bf0b71f8ac871dae89842b3add148c73e5a2d6c Mon Sep 17 00:00:00 2001
From: Sergio Gelato <Sergio.Gelato@astro.su.se>
Date: Wed, 19 Sep 2018 11:59:35 -0300
Subject: [PATCH] fix file descriptor leak in
ras-report.c:setup_report_socket()
A running instance of rasdaemon was seen to hit the limit on open file
descriptors. Most of the the descriptors were AF_UNIX STREAM sockets.
At the same time the limit was hit, attempts by rasdaemon to open the
SQLite database started failing with SQLite error 14.
This patch avoids leaking a socket file descriptor each time the connect()
call fails.
Signed-off-by: Sergio Gelato <Sergio.Gelato@astro.su.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
ras-report.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ras-report.c b/ras-report.c
index 661da84..2710eac 100644
--- a/ras-report.c
+++ b/ras-report.c
@@ -37,7 +37,8 @@ static int setup_report_socket(void){
addr.sun_path[sizeof(addr.sun_path) - 1] = '\0';
rc = connect(sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr_un));
- if (rc < 0){
+ if (rc < 0) {
+ close(sockfd);
return -1;
}
--
1.8.3.1

View File

@ -1,6 +1,6 @@
Name: rasdaemon Name: rasdaemon
Version: 0.6.3 Version: 0.6.3
Release: 1 Release: 2
License: GPLv2 License: GPLv2
Summary: Utility to get Platform Reliability, Availability and Serviceability (RAS) reports via the Kernel tracing events Summary: Utility to get Platform Reliability, Availability and Serviceability (RAS) reports via the Kernel tracing events
URL: https://github.com/mchehab/rasdaemon.git URL: https://github.com/mchehab/rasdaemon.git
@ -19,14 +19,14 @@ Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
Requires(postun): systemd Requires(postun): systemd
Patch6000: add-rbtree-support-for-page-record.patch Patch0: add-rbtree-support-for-page-record.patch
Patch1: fix-file-descriptor-leak-in-ras-report.c-setup_repor.patch
Patch9000: bugfix-ras-events-memory-leak.patch Patch2: bugfix-ras-events-memory-leak.patch
Patch9001: bugfix-rasdaemon-wait-for-file-access.patch Patch3: bugfix-rasdaemon-wait-for-file-access.patch
Patch9002: bugfix-fix-fd-check.patch Patch4: bugfix-fix-fd-check.patch
Patch9003: feature-mc-support-page-isolation.patch Patch5: feature-mc-support-page-isolation.patch
Patch9004: feature-report-ARM-processor-info.patch Patch6: feature-report-ARM-processor-info.patch
Patch9005: output-log-timely.patch Patch7: output-log-timely.patch
%description %description
The rasdaemon program is a daemon which monitors the platform The rasdaemon program is a daemon which monitors the platform
@ -74,5 +74,11 @@ rm INSTALL %{buildroot}/usr/include/*.h
/usr/bin/systemctl enable rasdaemon.service >/dev/null 2>&1 || : /usr/bin/systemctl enable rasdaemon.service >/dev/null 2>&1 || :
%changelog %changelog
* Tue Feb 25 2020 lvying<lvying6@huawei.com> - 0.6.3-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix file descriptor leak in ras-report.c:setup_report_socket()
* Wed Sep 18 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.6.3-1 * Wed Sep 18 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.6.3-1
- Package init - Package init