diff --git a/backport-util-fix-endless-loop-in-get_backoff_delta_msec.patch b/backport-util-fix-endless-loop-in-get_backoff_delta_msec.patch new file mode 100644 index 0000000000000000000000000000000000000000..bcf041941d917a8ac217456bd3cb2614cf22f234 --- /dev/null +++ b/backport-util-fix-endless-loop-in-get_backoff_delta_msec.patch @@ -0,0 +1,54 @@ +From f14f2603820e46b1946d8f96eee10c99690aea82 Mon Sep 17 00:00:00 2001 +From: Tobias Stoeckmann +Date: Sun, 29 Jun 2025 13:13:34 +0200 +Subject: [PATCH] util: fix endless loop in get_backoff_delta_msec + +If current time t is already past tend, the while loop in +get_backoff_delta_msec never ends. + +Signed-off-by: Tobias Stoeckmann +Link: https://github.com/kmod-project/kmod/pull/377 +Signed-off-by: Lucas De Marchi +--- + shared/util.c | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +diff --git a/shared/util.c b/shared/util.c +index 17f6fd1..27e9130 100644 +--- a/shared/util.c ++++ b/shared/util.c +@@ -504,16 +504,23 @@ unsigned long long get_backoff_delta_msec(unsigned long long t0, + + t = now_msec(); + +- if (!*delta) +- *delta = 1; +- else +- *delta <<= 1; ++ if (tend <= t) { ++ /* Timeout already reached */ ++ *delta = 0; ++ } else { ++ const unsigned long long limit = tend - t; ++ ++ if (!*delta) ++ *delta = 1; ++ else ++ *delta <<= 1; + +- while (t + *delta > tend) +- *delta >>= 1; ++ while (*delta > limit) ++ *delta >>= 1; + +- if (!*delta && tend > t) +- *delta = tend - t; ++ if (!*delta) ++ *delta = limit; ++ } + + return t + *delta; + } +-- +2.43.0 + diff --git a/kmod.spec b/kmod.spec index c07fa0e760be71d88282149188eb314ef0d4d89a..ea7a503907a76f24d56f1ce8014d12c9b7f7d374 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 30 -Release: 9 +Release: 10 Summary: Kernel module management # GPLv2+ is used by programs, LGPLv2+ is used for libraries. License: GPLv2+ and LGPLv2+ @@ -23,6 +23,7 @@ Patch0005: backport-libkmod-fix-possible-out-of-bounds-memory-access.patch Patch0006: backport-libkmod-clear-file-memory-if-map-fails.patch Patch0007: backport-check-strtol-strtoul-strtoull-results.patch Patch0008: backport-tools-modprobe-Fix-odd-remove-holders-behavior.patch +Patch0009: backport-util-fix-endless-loop-in-get_backoff_delta_msec.patch %description The kmod package provides several commands to manage the kernel modules, @@ -130,6 +131,9 @@ make check %doc TODO NEWS README.md %changelog +* Wed Oct 29 2025 liuh - 30-10 +- util: fix endless loop in get_backoff_delta_msec + * Tue Aug 26 2025 zhangjian - 30-9 - backport two patches from upstream