From: Jason Dillaman Date: Thu, 11 Jan 2018 03:42:05 +0000 (-0500) Subject: librbd: fixed memory leak and use-after-free in group snap API X-Git-Tag: v12.2.9~31^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fd4669c8f0ce7c5e6467814fd6a0246bbc5e64cd;p=ceph.git librbd: fixed memory leak and use-after-free in group snap API Signed-off-by: Jason Dillaman (cherry picked from commit 8d68fa2a8e0c292d74d5f4d0080e4db370f4685e) Conflicts: src/librbd/api/Group.cc: removed file --- diff --git a/src/librbd/Operations.cc b/src/librbd/Operations.cc index e9e8fa4b76fd..dddc6a020284 100644 --- a/src/librbd/Operations.cc +++ b/src/librbd/Operations.cc @@ -669,7 +669,7 @@ void Operations::execute_resize(uint64_t size, bool allow_shrink, ProgressCon template int Operations::snap_create(const cls::rbd::SnapshotNamespace &snap_namespace, - const char *snap_name) { + const std::string& snap_name) { if (m_image_ctx.read_only) { return -EROFS; } @@ -693,7 +693,7 @@ int Operations::snap_create(const cls::rbd::SnapshotNamespace &snap_namespace template void Operations::snap_create(const cls::rbd::SnapshotNamespace &snap_namespace, - const char *snap_name, + const std::string& snap_name, Context *on_finish) { CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << this << " " << __func__ << ": snap_name=" << snap_name @@ -753,7 +753,7 @@ void Operations::execute_snap_create(const cls::rbd::SnapshotNamespace &snap_ template int Operations::snap_rollback(const cls::rbd::SnapshotNamespace& snap_namespace, - const char *snap_name, + const std::string& snap_name, ProgressContext& prog_ctx) { CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << this << " " << __func__ << ": snap_name=" << snap_name @@ -833,7 +833,7 @@ void Operations::execute_snap_rollback(const cls::rbd::SnapshotNamespace& sna template int Operations::snap_remove(const cls::rbd::SnapshotNamespace& snap_namespace, - const char *snap_name) { + const std::string& snap_name) { if (m_image_ctx.read_only) { return -EROFS; } @@ -857,7 +857,7 @@ int Operations::snap_remove(const cls::rbd::SnapshotNamespace& snap_namespace template void Operations::snap_remove(const cls::rbd::SnapshotNamespace& snap_namespace, - const char *snap_name, + const std::string& snap_name, Context *on_finish) { CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << this << " " << __func__ << ": snap_name=" << snap_name @@ -1028,7 +1028,7 @@ void Operations::execute_snap_rename(const uint64_t src_snap_id, template int Operations::snap_protect(const cls::rbd::SnapshotNamespace& snap_namespace, - const char *snap_name) { + const std::string& snap_name) { CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << this << " " << __func__ << ": snap_name=" << snap_name << dendl; @@ -1123,7 +1123,7 @@ void Operations::execute_snap_protect(const cls::rbd::SnapshotNamespace& snap template int Operations::snap_unprotect(const cls::rbd::SnapshotNamespace& snap_namespace, - const char *snap_name) { + const std::string& snap_name) { CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << this << " " << __func__ << ": snap_name=" << snap_name << dendl; diff --git a/src/librbd/Operations.h b/src/librbd/Operations.h index 2b0c725b981b..ff1238ff50e5 100644 --- a/src/librbd/Operations.h +++ b/src/librbd/Operations.h @@ -45,26 +45,25 @@ public: Context *on_finish, uint64_t journal_op_tid); int snap_create(const cls::rbd::SnapshotNamespace &snap_namespace, - const char *snap_name); + const std::string& snap_name); void snap_create(const cls::rbd::SnapshotNamespace &snap_namespace, - const char *snap_name, - Context *on_finish); + const std::string& snap_name, Context *on_finish); void execute_snap_create(const cls::rbd::SnapshotNamespace &snap_namespace, const std::string &snap_name, Context *on_finish, uint64_t journal_op_tid, bool skip_object_map); int snap_rollback(const cls::rbd::SnapshotNamespace& snap_namespace, - const char *snap_name, + const std::string& snap_name, ProgressContext& prog_ctx); void execute_snap_rollback(const cls::rbd::SnapshotNamespace& snap_namespace, const std::string &snap_name, ProgressContext& prog_ctx, Context *on_finish); int snap_remove(const cls::rbd::SnapshotNamespace& snap_namespace, - const char *snap_name); + const std::string& snap_name); void snap_remove(const cls::rbd::SnapshotNamespace& snap_namespace, - const char *snap_name, + const std::string& snap_name, Context *on_finish); void execute_snap_remove(const cls::rbd::SnapshotNamespace& snap_namespace, const std::string &snap_name, @@ -76,13 +75,13 @@ public: Context *on_finish); int snap_protect(const cls::rbd::SnapshotNamespace& snap_namespace, - const char *snap_name); + const std::string& snap_name); void execute_snap_protect(const cls::rbd::SnapshotNamespace& snap_namespace, const std::string &snap_name, Context *on_finish); int snap_unprotect(const cls::rbd::SnapshotNamespace& snap_namespace, - const char *snap_name); + const std::string& snap_name); void execute_snap_unprotect(const cls::rbd::SnapshotNamespace& snap_namespace, const std::string &snap_name, Context *on_finish);