From 0b60d077cb57b13ae60abcad9fe8767db822f528 Mon Sep 17 00:00:00 2001 From: Evgeniy Kochetov Date: Thu, 1 Aug 2019 12:05:49 +0000 Subject: [PATCH] bdev/null: Fix infinite loop in configuration parsing Invalid configuration file parameter in Null bdev section results in infinite loop. Signed-off-by: Evgeniy Kochetov Signed-off-by: Sasha Kotchubievsky Signed-off-by: Alexey Marchuk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464775 (master) (cherry picked from commit e06e34be1de15192432ee90ca54372098290211f) Change-Id: I79a1a53e0f4d76a8724e7a624cabda7250b511c5 Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467131 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- module/bdev/null/bdev_null.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/module/bdev/null/bdev_null.c b/module/bdev/null/bdev_null.c index 6f64b4f60..b13749348 100644 --- a/module/bdev/null/bdev_null.c +++ b/module/bdev/null/bdev_null.c @@ -1,8 +1,8 @@ /*- * BSD LICENSE * - * Copyright (c) Intel Corporation. - * All rights reserved. + * Copyright (c) Intel Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -318,8 +318,7 @@ bdev_null_initialize(void) goto end; } - i = 0; - while (true) { + for (i = 0; ; ++i) { val = spdk_conf_section_get_nval(sp, "Dev", i); if (val == NULL) { break; @@ -362,8 +361,6 @@ bdev_null_initialize(void) SPDK_ERRLOG("Could not create null bdev\n"); goto end; } - - i++; } end: if (rc) {