event: fix null pointer issue in spdk_subsystem_fini
The variable cur could be null, so if we use do while will cause a segment fault Change-Id: I19ec26e88948a0c3fd957e03e717b68750f40c62 Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
parent
5603ff07b9
commit
e87e3df674
@ -149,14 +149,16 @@ spdk_subsystem_fini(void)
|
|||||||
struct spdk_subsystem *cur;
|
struct spdk_subsystem *cur;
|
||||||
|
|
||||||
cur = TAILQ_LAST(&g_subsystems, spdk_subsystem_list);
|
cur = TAILQ_LAST(&g_subsystems, spdk_subsystem_list);
|
||||||
do {
|
|
||||||
|
while (cur) {
|
||||||
if (cur->fini) {
|
if (cur->fini) {
|
||||||
rc = cur->fini();
|
rc = cur->fini();
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
cur = TAILQ_PREV(cur, spdk_subsystem_list, tailq);
|
cur = TAILQ_PREV(cur, spdk_subsystem_list, tailq);
|
||||||
} while (cur);
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user