ocfs2: fix memory leak in dlm_migrate_request_handler()
authorGuozhonghua <[email protected]>
Tue, 11 Oct 2016 20:51:01 +0000 (13:51 -0700)
committerLinus Torvalds <[email protected]>
Tue, 11 Oct 2016 22:06:30 +0000 (15:06 -0700)
In the dlm_migrate_request_handler(), when `ret' is -EEXIST, the mle
should be freed, otherwise the memory will be leaked.

Link: http://lkml.kernel.org/r/71604351584F6A4EBAE558C676F37CA4A3D3522A@H3CMLB12-EX.srv.huawei-3com.com
Signed-off-by: Guozhonghua <[email protected]>
Reviewed-by: Mark Fasheh <[email protected]>
Cc: Eric Ren <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: Junxiao Bi <[email protected]>
Cc: Joseph Qi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/ocfs2/dlm/dlmmaster.c

index 6ea06f8a7d295acd45e24f36a8fd50046897d78a..3f828a187049909070c0f3934f4b10a5a6ee5d3e 100644 (file)
@@ -3188,6 +3188,9 @@ int dlm_migrate_request_handler(struct o2net_msg *msg, u32 len, void *data,
                                    migrate->new_master,
                                    migrate->master);
 
+       if (ret < 0)
+               kmem_cache_free(dlm_mle_cache, mle);
+
        spin_unlock(&dlm->master_lock);
 unlock:
        spin_unlock(&dlm->spinlock);