From: Guozhonghua Date: Tue, 11 Oct 2016 20:51:01 +0000 (-0700) Subject: ocfs2: fix memory leak in dlm_migrate_request_handler() X-Git-Tag: v4.9-rc1~42^2~99 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0cc482ee41d609811bd7b91abdbcd1c5dbdfb783;p=platform%2Fkernel%2Flinux-exynos.git ocfs2: fix memory leak in dlm_migrate_request_handler() 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 Reviewed-by: Mark Fasheh Cc: Eric Ren Cc: Joel Becker Cc: Junxiao Bi Cc: Joseph Qi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 6ea06f8..3f828a1 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c @@ -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);