38 lines
1.1 KiB
Diff
38 lines
1.1 KiB
Diff
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
|
|
|