Fix Segmentation fault occurs due to recursion

This commit is contained in:
zhanghongtao 2022-12-07 11:42:19 +08:00
parent ad0b0307bd
commit fed7f75436
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From ade8e6254cb8720446dd38e2a29408ac57d7d5e6 Mon Sep 17 00:00:00 2001
From: zhanghongtao <zhanghongtao22@huawei.com>
Date: Wed, 7 Sep 2022 17:08:29 +0800
Subject: [PATCH] nvme_ctrlr_abort_queued_aborts Segmentation fault occurs due
to recursion
When ctrlr destruct,we need to abort queued aborts.
Function nvme_ctrlr_abort_queued_aborts has a recursive call,
ctrlr->queued_aborts has been processed in recursion.
Signed-off-by: zhanghongtao <zhanghongtao22@huawei.com>
---
lib/nvme/nvme_ctrlr.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c
index 6c25f0d..a84affb 100644
--- a/lib/nvme/nvme_ctrlr.c
+++ b/lib/nvme/nvme_ctrlr.c
@@ -1344,7 +1344,15 @@ nvme_ctrlr_abort_queued_aborts(struct spdk_nvme_ctrlr *ctrlr)
struct nvme_request *req, *tmp;
struct spdk_nvme_cpl cpl = {};
+#ifdef SPDK_CONFIG_APP_RW
+ if (ctrlr->is_destructed == true) {
+ cpl.status.sc = SPDK_NVME_SC_SUCCESS;
+ } else {
+ cpl.status.sc = SPDK_NVME_SC_ABORTED_SQ_DELETION;
+ }
+#else
cpl.status.sc = SPDK_NVME_SC_ABORTED_SQ_DELETION;
+#endif
cpl.status.sct = SPDK_NVME_SCT_GENERIC;
STAILQ_FOREACH_SAFE(req, &ctrlr->queued_aborts, stailq, tmp) {
--
2.27.0

View File

@ -4,7 +4,7 @@
Name: spdk
Version: 21.01.1
Release: 7
Release: 8
Summary: Set of libraries and utilities for high performance user-mode storage
License: BSD and MIT
URL: http://spdk.io
@ -38,6 +38,7 @@ Patch26: 0026-Fix-race-condition-in-continuous-setup-and-teardown-.patch
Patch27: 0027-Change-log-level-in-poll-timeout.patch
Patch28: 0028-configure-add-CONFIG_HAVE_ARC4RANDOM.patch
Patch29: 0029-Enable-unittest-in-make-check.patch
Patch30: 0030-nvme_ctrlr_abort_queued_aborts-Segmentation-fault-oc.patch
%define package_version %{version}-%{release}
@ -212,6 +213,9 @@ mv doc/output/html/ %{install_docdir}
%changelog
* Wed Dec 7 2022 Hongtao Zhang <zhanghongtao22@huawei.com> - 21.01.1-8
- Fix Segmentation fault occurs due to recursion
* Tue Nov 1 2022 Weifeng Su <suweifeng1@huawei.com> - 21.01.1-7
- Enable unittest