From 8455963c3277ce3ab26b0d453f81ef33d9a5e9c4 Mon Sep 17 00:00:00 2001 From: SuperSix173 Date: Tue, 24 Aug 2021 14:44:48 +0800 Subject: [PATCH] fix opendir fails in check_platform_device (cherry picked from commit ab60ca9847b34a4fe35c269e75b77096f10ba7f7) --- ...endir-fails-in-check_platform_device.patch | 52 +++++++++++++++++++ irqbalance.spec | 11 +++- 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 bugfix-fix-opendir-fails-in-check_platform_device.patch diff --git a/bugfix-fix-opendir-fails-in-check_platform_device.patch b/bugfix-fix-opendir-fails-in-check_platform_device.patch new file mode 100644 index 0000000..a614fe5 --- /dev/null +++ b/bugfix-fix-opendir-fails-in-check_platform_device.patch @@ -0,0 +1,52 @@ +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 + +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 | 25 +++++++++++-------------- + 1 file changed, 11 insertions(+), 14 deletions(-) + +diff --git a/procinterrupts.c b/procinterrupts.c +index 32c5e53..2bd201b 100644 +--- a/procinterrupts.c ++++ b/procinterrupts.c +@@ -183,20 +183,17 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq) + } + + #ifdef AARCH64 +- irq_name = last_token; +- tmp = strchr(irq_name, '\n'); +- if (tmp) +- *tmp = 0; +- +- if (strlen(irq_name) + strlen(savedptr) + 1 < PATH_MAX) { +- strcat(irq_fullname, irq_name); +- strcat(irq_fullname, " "); +- strcat(irq_fullname, savedptr); +- tmp = strchr(irq_fullname, '\n'); +- if (tmp) +- *tmp = 0; +- } else { +- irq_fullname_valid = 0; ++ if (strlen(savedptr) > 0) { ++ if (strlen(irq_name) + strlen(savedptr) + 1 < PATH_MAX) { ++ strcat(irq_fullname, irq_name); ++ strcat(irq_fullname, " "); ++ strcat(irq_fullname, savedptr); ++ tmp = strchr(irq_fullname, '\n'); ++ if (tmp) ++ *tmp = 0; ++ } else { ++ irq_fullname_valid = 0; ++ } + } + #endif + irq_mod = last_token; +-- +1.8.3.1 + diff --git a/irqbalance.spec b/irqbalance.spec index 64833bc..342b1d0 100644 --- a/irqbalance.spec +++ b/irqbalance.spec @@ -1,7 +1,7 @@ Summary: A dynamic adaptive IRQ balancing daemon Name: irqbalance Version: 1.8.0 -Release: 1 +Release: 2 Epoch: 3 License: GPLv2 Source0: https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz#/irqbalance-%{version}.tar.gz @@ -32,6 +32,7 @@ Patch9005: feature-add-new-irq-migrate-rule-to-avoid-high-cpu-i.patch Patch9006: feature-enable-irqbalance-to-link-with-multiple-clie.patch Patch9007: feature-add-ability-to-set-hintpolicy-during-runtime.patch Patch9008: feature-encapsulate-and-compile-the-functions-in-irqbalance-ui.patch +Patch9009: bugfix-fix-opendir-fails-in-check_platform_device.patch %description Irqbalance is a daemon to help balance the cpu load generated by @@ -118,6 +119,12 @@ fi /sbin/chkconfig --del %{name} >/dev/null 2>&1 || : %changelog +* Tue Aug 24 2021 Liu Chao - 3:1.8.0-2 +- Type:bugfix +- ID:NA +- SUG:restart +- DESC:fix opendir fails in check_platform_device + * Sat Apr 17 2021 Liu Chao - 3:1.8.0-1 - Type:enhanced - ID:NA @@ -130,7 +137,7 @@ fi - SUG:restart - DESC:backport patches -* Tue May 2 2021 Liu Chao - 3:1.7.0-4 +* Tue Mar 2 2021 Liu Chao - 3:1.7.0-4 - Type:enhanced - ID:NA - SUG:restart