]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon:validate hit_set values before set
authorlijing <lijing@gohighsec.com>
Wed, 17 Jan 2018 09:13:05 +0000 (17:13 +0800)
committerlijing <lijing@gohighsec.com>
Wed, 17 Jan 2018 09:13:14 +0000 (17:13 +0800)
Fixes: http://tracker.ceph.com/issues/22659
Signed-off-by: Jing Li lijing@gohighsec.com
src/mon/OSDMonitor.cc

index 87ab8c03afea9d1da9db3b01fec639b744f8ff9b..f58a78a13cdc281edc93be3845b2fd4c41d3231b 100644 (file)
@@ -6130,18 +6130,27 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
     if (interr.length()) {
       ss << "error parsing integer value '" << val << "': " << interr;
       return -EINVAL;
+    } else if (n < 0) {
+      ss << "hit_set_period should be non-negative";
+      return -EINVAL;
     }
     p.hit_set_period = n;
   } else if (var == "hit_set_count") {
     if (interr.length()) {
       ss << "error parsing integer value '" << val << "': " << interr;
       return -EINVAL;
+    } else if (n < 0) {
+      ss << "hit_set_count should be non-negative";
+      return -EINVAL;
     }
     p.hit_set_count = n;
   } else if (var == "hit_set_fpp") {
     if (floaterr.length()) {
       ss << "error parsing floating point value '" << val << "': " << floaterr;
       return -EINVAL;
+    } else if (f < 0 || f > 1.0) {
+      ss << "hit_set_fpp should be in the range 0..1";
+      return -EINVAL;
     }
     if (p.hit_set_params.get_type() != HitSet::TYPE_BLOOM) {
       ss << "hit set is not of type Bloom; invalid to set a false positive rate!";