From 4d09e06374179c0ab556b7f995ed48a067075b28 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sun, 12 Jun 2022 20:26:02 +0300 Subject: [PATCH] irqbalance: upstream patch to fix segfault Apply post-1.9.0 patch from upstream to fix a segfault. savedptr can be NULL, so guard for that. Fixes #18741 Signed-off-by: Hannu Nyman (cherry picked from commit ab7a23102e85aaab1e0ff2ba6874e7d6b09f45d5) --- ...0002-post-190-fix-check-saveptr-NULL.patch | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 utils/irqbalance/patches/0002-post-190-fix-check-saveptr-NULL.patch diff --git a/utils/irqbalance/patches/0002-post-190-fix-check-saveptr-NULL.patch b/utils/irqbalance/patches/0002-post-190-fix-check-saveptr-NULL.patch new file mode 100644 index 000000000..637c96bbd --- /dev/null +++ b/utils/irqbalance/patches/0002-post-190-fix-check-saveptr-NULL.patch @@ -0,0 +1,23 @@ +From 522883505d3b02e3294f045f49007b61c00e2c31 Mon Sep 17 00:00:00 2001 +From: Chao Liu +Date: Wed, 8 Jun 2022 10:04:02 +0800 +Subject: [PATCH] check whether savedptr is NULL before invoking strlen + +savedptr can be null in musl libc, so the strlen(NULL) will segfault + +Signed-off-by: Chao Liu +--- + procinterrupts.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/procinterrupts.c ++++ b/procinterrupts.c +@@ -178,7 +178,7 @@ void init_irq_class_and_type(char *saved + } + + #ifdef AARCH64 +- if (strlen(savedptr) > 0) { ++ if (savedptr && strlen(savedptr) > 0) { + snprintf(irq_fullname, PATH_MAX, "%s %s", last_token, savedptr); + tmp = strchr(irq_fullname, '\n'); + if (tmp)