<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <small> </small>
    <pre wrap=""><small><big><big><small>We found a possible memory leak in dlm_process_recovery_data when doing
code review. In dlm_process_recovery_data, it creates newlock each time,
but don't free when it is bad, and then it will lead to memory leak.

Cc: <a class="moz-txt-link-abbreviated" href="mailto:stable@vger.kernel.org">stable@vger.kernel.org</a>
Signed-off-by: Joseph Qi <a class="moz-txt-link-rfc2396E" href="mailto:joseph.qi@huawei.com">&lt;joseph.qi@huawei.com&gt;</a>
Reviewed-by: Jie Liu <a class="moz-txt-link-rfc2396E" href="mailto:jeff.liu@oracle.com">&lt;jeff.liu@oracle.com&gt;</a>

---
 fs/ocfs2/dlm/dlmrecovery.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index eeac97b..9f08523 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -1974,6 +1974,10 @@ skip_lvb:
                              res-&gt;lockname.len, res-&gt;lockname.name, ml-&gt;node);
                         dlm_lockres_set_refmap_bit(dlm, res, ml-&gt;node);
                         added++;
+                } else {
+                        /* Free the new lock if it is bad */
+                        dlm_lock_put(newlock);
+                        newlock = NULL;
                 }
                 spin_unlock(&amp;res-&gt;spinlock);
         }
-- 
1.7.9.7</small>

</big></big></small></pre>
    <small> </small>
  </body>
</html>