From 32964b3f6472207b9b0a2ca08cab92cb56d1f121 Mon Sep 17 00:00:00 2001 From: Misono Tomohiro Date: Mon, 31 May 2021 21:01:59 +0900 Subject: [PATCH] osd/ECBackend: Fix null pointer dereference when enabling jaeger tracing As comment in header says client_op might be null, we need to check it first before accessing client_op->osd_parent_span. Fixes: #51030 Signed-off-by: Misono Tomohiro --- src/osd/ECBackend.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index 70b6d734f4b..7938f5c0eb7 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -941,7 +941,7 @@ void ECBackend::handle_sub_write( msg->mark_event("sub_op_started"); trace.event("handle_sub_write"); #ifdef HAVE_JAEGER - if (msg->osd_parent_span) { + if (msg && msg->osd_parent_span) { auto ec_sub_trans = jaeger_tracing::child_span(__func__, msg->osd_parent_span); } #endif @@ -1544,7 +1544,7 @@ void ECBackend::submit_transaction( op->trace = client_op->pg_trace; #ifdef HAVE_JAEGER - if (client_op->osd_parent_span) { + if (client_op && client_op->osd_parent_span) { auto ec_sub_trans = jaeger_tracing::child_span("ECBackend::submit_transaction", client_op->osd_parent_span); } #endif @@ -2118,7 +2118,7 @@ bool ECBackend::try_reads_to_commit() } #ifdef HAVE_JAEGER - if (op->client_op->osd_parent_span) { + if (op->client_op && op->client_op->osd_parent_span) { auto sub_write_span = jaeger_tracing::child_span("EC sub write", op->client_op->osd_parent_span); } #endif