From 99249c49671872219715c82edbdcebc57ba5ac3b Mon Sep 17 00:00:00 2001 From: Zhao Cuicui Date: Mon, 5 Jul 2021 16:53:17 +0800 Subject: [PATCH] mon: return -EINVAL when handling unknown option in 'ceph osd pool get' Signed-off-by: Zhao Cuicui (cherry picked from commit 7ed494076e2390f8e6a386278346632d00ee718a) --- src/mon/OSDMonitor.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 4ccc3a4e503f5..ec2eb12235450 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -6191,6 +6191,13 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) } } else /* var != "all" */ { choices_map_t::const_iterator found = ALL_CHOICES.find(var); + if (found == ALL_CHOICES.end()) { + ss << "pool '" << poolstr + << "': invalid variable: '" << var << "'"; + r = -EINVAL; + goto reply; + } + osd_pool_get_choices selected = found->second; if (!p->is_tier() && -- 2.39.5