set hint->name in add_new_irq to avoid segmentation fault
This commit is contained in:
parent
9cc8390572
commit
3a0c81f608
81
bugfix-set-hint-name-in-add_new_irq-to-avoid-segment.patch
Normal file
81
bugfix-set-hint-name-in-add_new_irq-to-avoid-segment.patch
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
From 6f0ea91bfa9ee3016abf694e6fb9f46e7c847cc1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: SuperSix173 <liuchao173@huawei.com>
|
||||||
|
Date: Mon, 1 Nov 2021 11:40:39 +0800
|
||||||
|
Subject: [PATCH] bugfix: set hint->name in add_new_irq to avoid segmentation
|
||||||
|
fault
|
||||||
|
|
||||||
|
hint->name is uninitialized in add_new_irq, so segmentation fault occurs
|
||||||
|
when calling strstr in get_usr_irq_policy
|
||||||
|
|
||||||
|
Signed-off-by: SuperSix173 <liuchao173@huawei.com>
|
||||||
|
---
|
||||||
|
classify.c | 14 +++++++++++++-
|
||||||
|
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/classify.c b/classify.c
|
||||||
|
index c5a2a35..560e932 100644
|
||||||
|
--- a/classify.c
|
||||||
|
+++ b/classify.c
|
||||||
|
@@ -607,6 +607,7 @@ static void add_new_irq(char *path, struct irq_info *hint, GList *proc_interrupt
|
||||||
|
struct irq_info *new;
|
||||||
|
struct user_irq_policy pol;
|
||||||
|
int irq = hint->irq;
|
||||||
|
+ GList *entry;
|
||||||
|
|
||||||
|
new = get_irq_info(irq);
|
||||||
|
if (new)
|
||||||
|
@@ -620,6 +621,11 @@ static void add_new_irq(char *path, struct irq_info *hint, GList *proc_interrupt
|
||||||
|
__add_banned_irq(irq, &banned_irqs);
|
||||||
|
new = get_irq_info(irq);
|
||||||
|
} else {
|
||||||
|
+ if (!hint->name) {
|
||||||
|
+ entry = g_list_find_custom(proc_interrupts, hint, compare_ints);
|
||||||
|
+ if (entry)
|
||||||
|
+ hint->name = ((struct irq_info *)entry->data)->name;
|
||||||
|
+ }
|
||||||
|
new = add_one_irq_to_db(path, hint, &pol);
|
||||||
|
if ((new != NULL) && (user_policy_list != NULL)) {
|
||||||
|
set_usr_irq_policy(hint->name, new);
|
||||||
|
@@ -660,6 +666,7 @@ static void build_one_dev_entry(const char *dirname, GList *tmp_irqs, int build_
|
||||||
|
if (irqnum && ((build_irq < 0) || (irqnum == build_irq))) {
|
||||||
|
hint.irq = irqnum;
|
||||||
|
hint.type = IRQ_TYPE_MSIX;
|
||||||
|
+ hint.name = NULL;
|
||||||
|
add_new_irq(devpath, &hint, tmp_irqs);
|
||||||
|
if (build_irq >= 0) {
|
||||||
|
log(TO_CONSOLE, LOG_INFO, "Hotplug dev irq: %d finished.\n", irqnum);
|
||||||
|
@@ -688,6 +695,7 @@ static void build_one_dev_entry(const char *dirname, GList *tmp_irqs, int build_
|
||||||
|
if ((build_irq < 0) || (irqnum == build_irq)) {
|
||||||
|
hint.irq = irqnum;
|
||||||
|
hint.type = IRQ_TYPE_LEGACY;
|
||||||
|
+ hint.name = NULL;
|
||||||
|
add_new_irq(devpath, &hint, tmp_irqs);
|
||||||
|
if (build_irq >= 0)
|
||||||
|
log(TO_CONSOLE, LOG_INFO, "Hotplug dev irq: %d finished.\n", irqnum);
|
||||||
|
@@ -764,11 +772,13 @@ static struct irq_info * build_dev_irqs(GList *tmp_irqs, int build_irq)
|
||||||
|
int proc_irq_hotplug(char *savedline, int irq, struct irq_info **pinfo)
|
||||||
|
{
|
||||||
|
struct irq_info tmp_info = {0};
|
||||||
|
+ GList *tmp_list = NULL;
|
||||||
|
|
||||||
|
/* firstly, init irq info by parse savedline */
|
||||||
|
init_irq_class_and_type(savedline, &tmp_info, irq);
|
||||||
|
+ tmp_list = g_list_append(tmp_list, &tmp_info);
|
||||||
|
/* secondly, init irq info by read device info */
|
||||||
|
- *pinfo = build_dev_irqs(interrupts_db, irq);
|
||||||
|
+ *pinfo = build_dev_irqs(tmp_list, irq);
|
||||||
|
if (*pinfo == NULL) {
|
||||||
|
add_new_irq(NULL, &tmp_info, interrupts_db);
|
||||||
|
*pinfo = get_irq_info(irq);
|
||||||
|
@@ -779,6 +789,8 @@ int proc_irq_hotplug(char *savedline, int irq, struct irq_info **pinfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
force_rebalance_irq(*pinfo, NULL);
|
||||||
|
+ free(tmp_info.name);
|
||||||
|
+ g_list_free(tmp_list);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
Summary: A dynamic adaptive IRQ balancing daemon
|
Summary: A dynamic adaptive IRQ balancing daemon
|
||||||
Name: irqbalance
|
Name: irqbalance
|
||||||
Version: 1.8.0
|
Version: 1.8.0
|
||||||
Release: 3
|
Release: 4
|
||||||
Epoch: 3
|
Epoch: 3
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Source0: https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz#/irqbalance-%{version}.tar.gz
|
Source0: https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz#/irqbalance-%{version}.tar.gz
|
||||||
@ -35,6 +35,7 @@ Patch9006: feature-enable-irqbalance-to-link-with-multiple-clie.patch
|
|||||||
Patch9007: feature-add-ability-to-set-hintpolicy-during-runtime.patch
|
Patch9007: feature-add-ability-to-set-hintpolicy-during-runtime.patch
|
||||||
Patch9008: feature-encapsulate-and-compile-the-functions-in-irqbalance-ui.patch
|
Patch9008: feature-encapsulate-and-compile-the-functions-in-irqbalance-ui.patch
|
||||||
Patch9009: bugfix-fix-opendir-fails-in-check_platform_device.patch
|
Patch9009: bugfix-fix-opendir-fails-in-check_platform_device.patch
|
||||||
|
Patch9010: bugfix-set-hint-name-in-add_new_irq-to-avoid-segment.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Irqbalance is a daemon to help balance the cpu load generated by
|
Irqbalance is a daemon to help balance the cpu load generated by
|
||||||
@ -121,6 +122,12 @@ fi
|
|||||||
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
|
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Nov 1 2021 Liu Chao <liuchao173@huawei.com> - 3:1.8.0-4
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:restart
|
||||||
|
- DESC:set hint->name in add_new_irq to avoid segmentation fault
|
||||||
|
|
||||||
* Wed Aug 25 2021 Liu Chao <liuchao173@huawei.com> - 3:1.8.0-3
|
* Wed Aug 25 2021 Liu Chao <liuchao173@huawei.com> - 3:1.8.0-3
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user