[PATCH 3/5] lib,cpuset: fix stride handling in cpulist_parse()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If cpulist_parse() gets passed a cpu list with a stride value of 0
it will be stuck in an endless loop.
E.g. the following cpu list will cause an endless loop: "0-2:0".
Fix this by causing a parse error if the stride value is 0.

Signed-off-by: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
---
 lib/cpuset.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/cpuset.c b/lib/cpuset.c
index cf22aa7..8592755 100644
--- a/lib/cpuset.c
+++ b/lib/cpuset.c
@@ -292,6 +292,8 @@ int cpulist_parse(const char *str, cpu_set_t *set, size_t setsize, int fail)
 			if (c1 != NULL && (c2 == NULL || c1 < c2)) {
 				if (sscanf(c1, "%u", &s) < 1)
 					return 1;
+				if (s == 0)
+					return 1;
 			}
 		}
 
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux