From 7ed494076e2390f8e6a386278346632d00ee718a 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 --- src/mon/OSDMonitor.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index db8e9990e91a3..0bce1aac6c4bb 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -6152,6 +6152,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