Skip to content

Commit

Permalink
Merge pull request ceph#6078 from H3C/wip-13208
Browse files Browse the repository at this point in the history
Objecter: maybe access wild pointer(op) in _op_submit_with_budget.

Reviewed-by: Kefu Chai <[email protected]>
  • Loading branch information
liewegas committed Sep 28, 2015
2 parents 14a36a2 + 0635b13 commit 04f9ae5
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/osdc/Objecter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1998,13 +1998,10 @@ class C_CancelOp : public Context
ceph_tid_t tid;
Objecter *objecter;
public:
C_CancelOp(Objecter *objecter) : objecter(objecter) {}
C_CancelOp(ceph_tid_t tid, Objecter *objecter) : tid(tid), objecter(objecter) {}
void finish(int r) {
objecter->op_cancel(tid, -ETIMEDOUT);
}
void set_tid(ceph_tid_t _tid) {
tid = _tid;
}
};

ceph_tid_t Objecter::op_submit(Op *op, int *ctx_budget)
Expand Down Expand Up @@ -2033,21 +2030,15 @@ ceph_tid_t Objecter::_op_submit_with_budget(Op *op, RWLock::Context& lc, int *ct
}
}

C_CancelOp *cb = NULL;
if (osd_timeout > 0) {
cb = new C_CancelOp(this);
op->ontimeout = cb;
}

ceph_tid_t tid = _op_submit(op, lc);

if (cb) {
cb->set_tid(tid);
if (op->tid == 0)
op->tid = last_tid.inc();
op->ontimeout = new C_CancelOp(op->tid, this);
Mutex::Locker l(timer_lock);
timer.add_event_after(osd_timeout, op->ontimeout);
}

return tid;
return _op_submit(op, lc);
}

void Objecter::_send_op_account(Op *op)
Expand Down

0 comments on commit 04f9ae5

Please sign in to comment.