]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: drop election messages with bad rank
authorSage Weil <sage@newdream.net>
Tue, 7 Feb 2012 22:18:52 +0000 (14:18 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Tue, 7 Feb 2012 22:31:23 +0000 (14:31 -0800)
The bad message came from old code pre-bfbeae68c045de76ede86ca4f72d2a760a19c84b.

Fixes: #1909
Signed-off-by: Sage Weil <sage@newdream.net>
src/mon/Elector.cc

index 1e2abee8ad5023be0b790fb029ebd308b3163cc5..a7bac193ca491e215f83f733664549bea1eb5cf4 100644 (file)
@@ -223,7 +223,7 @@ void Elector::handle_ack(MMonElection *m)
 {
   dout(5) << "handle_ack from " << m->get_source() << dendl;
   int from = m->get_source().num();
-  
+
   assert(m->epoch % 2 == 1); // election
   if (m->epoch > epoch) {
     dout(5) << "woah, that's a newer epoch, i must have rebooted.  bumping and re-starting!" << dendl;
@@ -293,6 +293,12 @@ void Elector::dispatch(Message *m)
         m->put();
         return;
       }
+      if (m->get_source().num() >= mon->monmap->size()) {
+       dout(5) << " ignoring bogus election message with bad mon rank " << m->get_source() << dendl;
+       m->put();
+       return;
+      }
+
       MMonElection *em = (MMonElection*)m;
 
       // assume an old message encoding would have matched