From: myoungwon oh Date: Tue, 2 Feb 2021 06:43:14 +0000 (+0900) Subject: osd: fix to call nullptr when cancel_manifest_ops X-Git-Tag: v17.1.0~3070^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=88b364ba441bea02e8c0b64d3ab4fde56d19fe2f;p=ceph.git osd: fix to call nullptr when cancel_manifest_ops Segmentation fault can occur because cancel_manifest_ops must call callback without checking nullptr even though ManifestOp can be used with null callback in start_dedup() Signed-off-by: Myoungwon Oh --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 663b8fb011d5..4c982be482e0 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -3283,7 +3283,9 @@ struct C_SetManifestRefCountDone : public Context { // raced with cancel_manifest_ops return; } - it->second->cb->complete(r); + if (it->second->cb) { + it->second->cb->complete(r); + } pg->manifest_ops.erase(it); mop.reset(); } @@ -3322,8 +3324,10 @@ void PrimaryLogPG::cancel_manifest_ops(bool requeue, vector *tids) tids->push_back(mop->objecter_tid); mop->objecter_tid = 0; } - mop->cb->set_requeue(requeue); - mop->cb->complete(-ECANCELED); + if (mop->cb) { + mop->cb->set_requeue(requeue); + mop->cb->complete(-ECANCELED); + } manifest_ops.erase(p++); } }