<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=windows-1252">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-forward-container"><br>
      -------- Forwarded Message --------
      <table class="moz-email-headers-table" border="0" cellpadding="0"
        cellspacing="0">
        <tbody>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject:
            </th>
            <td>[PATCH] dm-log-userspace: fix memory leak on failure
              path in dm_ulog_tfr_init()</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date: </th>
            <td>Wed, 1 Oct 2014 22:58:35 +0200</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">From: </th>
            <td>Alexey Khoroshilov <a class="moz-txt-link-rfc2396E" href="mailto:khoroshilov@ispras.ru"><khoroshilov@ispras.ru></a></td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">To: </th>
            <td>Alasdair Kergon <a class="moz-txt-link-rfc2396E" href="mailto:agk@redhat.com"><agk@redhat.com></a>, Mike Snitzer
              <a class="moz-txt-link-rfc2396E" href="mailto:snitzer@redhat.com"><snitzer@redhat.com></a></td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">CC: </th>
            <td>Alexey Khoroshilov <a class="moz-txt-link-rfc2396E" href="mailto:khoroshilov@ispras.ru"><khoroshilov@ispras.ru></a>,
              <a class="moz-txt-link-abbreviated" href="mailto:dm-devel@redhat.com">dm-devel@redhat.com</a>, Neil Brown <a class="moz-txt-link-rfc2396E" href="mailto:neilb@suse.de"><neilb@suse.de></a>,
              <a class="moz-txt-link-abbreviated" href="mailto:linux-raid@vger.kernel.org">linux-raid@vger.kernel.org</a>, <a class="moz-txt-link-abbreviated" href="mailto:linux-kernel@vger.kernel.org">linux-kernel@vger.kernel.org</a>,
              <a class="moz-txt-link-abbreviated" href="mailto:ldv-project@linuxtesting.org">ldv-project@linuxtesting.org</a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <pre>If cn_add_callback() fails in dm_ulog_tfr_init(), it does not
deallocate prealloced memory but calls cn_del_callback().
It looks like a misprint.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <a class="moz-txt-link-rfc2396E" href="mailto:khoroshilov@ispras.ru"><khoroshilov@ispras.ru></a>
---
 drivers/md/dm-log-userspace-transfer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c
index b428c0ae63d5..39ad9664d397 100644
--- a/drivers/md/dm-log-userspace-transfer.c
+++ b/drivers/md/dm-log-userspace-transfer.c
@@ -272,7 +272,7 @@ int dm_ulog_tfr_init(void)
 
        r = cn_add_callback(&ulog_cn_id, "dmlogusr", cn_ulog_callback);
        if (r) {
-               cn_del_callback(&ulog_cn_id);
+               kfree(prealloced_cn_msg);
                return r;
        }
 
-- 
1.9.1


</pre>
      <br>
    </div>
    <br>
  </body>
</html>