diff --git a/fix-file-descriptor-leak-in-ras-report.c-setup_repor.patch b/fix-file-descriptor-leak-in-ras-report.c-setup_repor.patch new file mode 100644 index 0000000000000000000000000000000000000000..29741958b8ac96978248e6fa25848626f58ab82a --- /dev/null +++ b/fix-file-descriptor-leak-in-ras-report.c-setup_repor.patch @@ -0,0 +1,36 @@ +From 4bf0b71f8ac871dae89842b3add148c73e5a2d6c Mon Sep 17 00:00:00 2001 +From: Sergio Gelato +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 +Signed-off-by: Mauro Carvalho Chehab +--- + 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 diff --git a/rasdaemon.spec b/rasdaemon.spec index f73a4044952871ddd6725a2fb7e54c343efe6812..d0ec6bd034196aa59463be7fa56c1caba96c5638 100644 --- a/rasdaemon.spec +++ b/rasdaemon.spec @@ -1,6 +1,6 @@ Name: rasdaemon Version: 0.6.3 -Release: 1 +Release: 2 License: GPLv2 Summary: Utility to get Platform Reliability, Availability and Serviceability (RAS) reports via the Kernel tracing events URL: https://github.com/mchehab/rasdaemon.git @@ -20,6 +20,7 @@ Requires(preun): systemd Requires(postun): systemd Patch6000: add-rbtree-support-for-page-record.patch +Patch6001: fix-file-descriptor-leak-in-ras-report.c-setup_repor.patch Patch9000: bugfix-ras-events-memory-leak.patch Patch9001: bugfix-rasdaemon-wait-for-file-access.patch @@ -74,5 +75,11 @@ rm INSTALL %{buildroot}/usr/include/*.h /usr/bin/systemctl enable rasdaemon.service >/dev/null 2>&1 || : %changelog +* Tue Feb 25 2020 lvying - 0.6.3-1.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 - 0.6.3-1 - Package init