summaryrefslogtreecommitdiffstats
path: root/src/mon/Monitor.cc
diff options
context:
space:
mode:
authorNikhil Kshirsagar <nikhil.kshirsagar@canonical.com>2022-09-12 08:33:59 +0200
committerNikhil Kshirsagar <nkshirsagar@gmail.com>2022-10-13 09:44:40 +0200
commitf3d771aabc07f7517efb051bf70d2df1657172b4 (patch)
treec40d1bce848ec3880c99474885f6a562f21d0d7e /src/mon/Monitor.cc
parentMerge pull request #47976 from rhcs-dashboard/fix-duplicate-snapshot (diff)
downloadceph-f3d771aabc07f7517efb051bf70d2df1657172b4.tar.xz
ceph-f3d771aabc07f7517efb051bf70d2df1657172b4.zip
mon: Bail from handle_command() if _generate_command_map() fails
Bail out of handle_command() if _generate_command_map() throws an exception due to invalid json. This is an additional fix for the one that went in through 1109e62f6a3c0a7e06a088c4b833c8ecec51f791 Fixes: https://tracker.ceph.com/issues/57859 Signed-off-by: Nikhil Kshirsagar <nikhil.kshirsagar@canonical.com>
Diffstat (limited to 'src/mon/Monitor.cc')
-rw-r--r--src/mon/Monitor.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc
index 35c71b68158..c7425847bf6 100644
--- a/src/mon/Monitor.cc
+++ b/src/mon/Monitor.cc
@@ -3442,9 +3442,9 @@ void Monitor::handle_command(MonOpRequestRef op)
// Catch bad_cmd_get exception if _generate_command_map() throws it
try {
_generate_command_map(cmdmap, param_str_map);
- }
- catch(bad_cmd_get& e) {
+ } catch (const bad_cmd_get& e) {
reply_command(op, -EINVAL, e.what(), 0);
+ return;
}
if (!_allowed_command(session, service, prefix, cmdmap,