]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: fixed memory leak and use-after-free in group snap API
authorJason Dillaman <dillaman@redhat.com>
Thu, 11 Jan 2018 03:42:05 +0000 (22:42 -0500)
committerJason Dillaman <dillaman@redhat.com>
Mon, 1 Oct 2018 18:52:20 +0000 (14:52 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 8d68fa2a8e0c292d74d5f4d0080e4db370f4685e)

Conflicts:
src/librbd/api/Group.cc: removed file

src/librbd/Operations.cc
src/librbd/Operations.h

index e9e8fa4b76fdf2a6f50ed044d661fac11fe1e770..dddc6a02028481aa591dce16c81f3d5fd5769317 100644 (file)
@@ -669,7 +669,7 @@ void Operations<I>::execute_resize(uint64_t size, bool allow_shrink, ProgressCon
 
 template <typename I>
 int Operations<I>::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<I>::snap_create(const cls::rbd::SnapshotNamespace &snap_namespace
 
 template <typename I>
 void Operations<I>::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<I>::execute_snap_create(const cls::rbd::SnapshotNamespace &snap_
 
 template <typename I>
 int Operations<I>::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<I>::execute_snap_rollback(const cls::rbd::SnapshotNamespace& sna
 
 template <typename I>
 int Operations<I>::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<I>::snap_remove(const cls::rbd::SnapshotNamespace& snap_namespace
 
 template <typename I>
 void Operations<I>::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<I>::execute_snap_rename(const uint64_t src_snap_id,
 
 template <typename I>
 int Operations<I>::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<I>::execute_snap_protect(const cls::rbd::SnapshotNamespace& snap
 
 template <typename I>
 int Operations<I>::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;
index 2b0c725b981b02977954a3fc5ac930a6e92fb9a5..ff1238ff50e549e28711c7284730a29723318cfb 100644 (file)
@@ -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);