Commit e06e34be authored by Evgeniy Kochetov's avatar Evgeniy Kochetov Committed by Jim Harris
Browse files

bdev/null: Fix infinite loop in configuration parsing



Invalid configuration file parameter in Null bdev section results in
infinite loop.

Signed-off-by: default avatarEvgeniy Kochetov <evgeniik@mellanox.com>
Signed-off-by: default avatarSasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: default avatarAlexey Marchuk <alexeymar@mellanox.com>
Change-Id: I79a1a53e0f4d76a8724e7a624cabda7250b511c5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464775


Reviewed-by: default avatarBroadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent cdde42d5
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
/*-
 *   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) {