From: Jason Dillaman Date: Sat, 17 Sep 2016 12:29:15 +0000 (-0400) Subject: librbd: corrected use-after-free in ImageWatcher X-Git-Tag: v10.2.4~28^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4babd3fa335351bd4327cded47a1ffe5a8cfd897;p=ceph.git librbd: corrected use-after-free in ImageWatcher Fixes: http://tracker.ceph.com/issues/17289 Signed-off-by: Jason Dillaman (cherry picked from commit 2f4d4868e3b721c932c35ae7e8f0dd96b36a37fc) --- diff --git a/src/librbd/ImageWatcher.cc b/src/librbd/ImageWatcher.cc index c828163b8ad..38083b42a5f 100644 --- a/src/librbd/ImageWatcher.cc +++ b/src/librbd/ImageWatcher.cc @@ -61,9 +61,10 @@ struct C_UnwatchAndFlush : public Context { // to completing the callback to avoid racing an explicit // librados shutdown Context *ctx = on_finish; + r = ret_val; delete this; - ctx->complete(ret_val); + ctx->complete(r); } virtual void finish(int r) override {