From: Nikhil Kshirsagar Date: Mon, 12 Sep 2022 06:33:59 +0000 (+0000) Subject: mon: Bail from handle_command() if _generate_command_map() fails X-Git-Tag: v17.2.6~91^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0c82a3b1172b195cffdc55e8371f9e5bb01558fa;p=ceph.git 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 (cherry picked from commit f3d771aabc07f7517efb051bf70d2df1657172b4) --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 1cc8da3d6614..f1732209bce9 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,