irqbalance: fix opendir fails in check_platform_device

fix opendir fails in check_platform_device

Signed-off-by: qinyu <qinyu32@huawei.com>
This commit is contained in:
qinyu 2023-01-05 15:47:41 +08:00
parent f97c2da792
commit 450e509daa
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,39 @@
From a9f0290a6754a475eb95818dd38dc401370da071 Mon Sep 17 00:00:00 2001
From: liuchao173 <55137861+liuchao173@users.noreply.github.com>
Date: Mon, 23 Aug 2021 19:40:41 +0800
Subject: [PATCH] fix opendir fails in check_platform_device
Reference: https://github.com/Irqbalance/irqbalance/commit/a9f0290a6754a475eb95818dd38dc401370da071
Conflict: NA
When irq name does not contain spaces, savedptr is an empty string and irq_fullname will have a extra space at the end like "LNRO0005:00 ".
So opendir in check_platform_device will fail, and irqbalance prints log:
"No directory /sys/devices/platform/LNRO0005:00 /: No such file or directory"
---
procinterrupts.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/procinterrupts.c b/procinterrupts.c
index e372671..9015177 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -178,10 +178,12 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq)
}
#ifdef AARCH64
- snprintf(irq_fullname, PATH_MAX, "%s %s", last_token, savedptr);
- tmp = strchr(irq_fullname, '\n');
- if (tmp)
- *tmp = 0;
+ if (strlen(savedptr) > 0) {
+ snprintf(irq_fullname, PATH_MAX, "%s %s", last_token, savedptr);
+ tmp = strchr(irq_fullname, '\n');
+ if (tmp)
+ *tmp = 0;
+ }
#else
snprintf(irq_fullname, PATH_MAX, "%s", last_token);
#endif
--
2.33.0

View File

@ -1,7 +1,7 @@
Summary: A dynamic adaptive IRQ balancing daemon
Name: irqbalance
Version: 1.7.0
Release: 17
Release: 18
Epoch: 3
License: GPLv2
Source0: https://github.com/Irqbalance/irqbalance/archive/irqbalance-%{version}.tar.gz
@ -36,6 +36,7 @@ Patch6011: backport-remove-no-existing-irq-in-banned_irqs.patch
Patch6012: backport-Add-0-to-the-end-of-strings-to-avoid-heap-buffer-ove.patch
Patch6013: backport-Fix-parse_proc_interrupts-fix-parsing-interrupt-counts.patch
Patch6014: backport-Fix-add-keep_going-check-to-prevent-irqbalance-from-failing-to-exit-after-SIGTERM.patch
Patch6015: backport-fix-opendir-fails-in-check_platform_device.patch
%description
Irqbalance is a daemon to help balance the cpu load generated by
@ -93,6 +94,12 @@ fi
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
%changelog
* Thu Jan 5 2023 qinyu <qinyu32@huawei.com> - 3:1.7.0-18
- Type:bugfix
- ID:NA
- SUG:restart
- DESC: fix opendir fails in check_platform_device
* Thu Jan 5 2023 qinyu <qinyu32@huawei.com> - 3:1.7.0-17
- Type:bugfix
- ID:NA