From: Liang Zhen Date: Mon, 14 Sep 2015 22:41:33 +0000 (-0400) Subject: staging/lustre/o2iblnd: leak cmid in kiblnd_dev_need_failover X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=199a0cc08d8552b9683150ef49ebceb764e436eb;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git staging/lustre/o2iblnd: leak cmid in kiblnd_dev_need_failover cmid created by kiblnd_dev_need_failover should always be destroyed, however it is not the case in current implementation and we will leak cmid when this function detected a device failover. Signed-off-by: Liang Zhen Reviewed-on: http://review.whamcloud.com/14603 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6480 Reviewed-by: Isaac Huang Reviewed-by: Andreas Dilger Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index c29d2ced258c..faa70f0b9b1e 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -2228,13 +2228,10 @@ static int kiblnd_dev_need_failover(kib_dev_t *dev) return rc; } - if (dev->ibd_hdev->ibh_ibdev == cmid->device) { - /* don't need device failover */ - rdma_destroy_id(cmid); - return 0; - } + rc = dev->ibd_hdev->ibh_ibdev != cmid->device; /* true for failover */ + rdma_destroy_id(cmid); - return 1; + return rc; } int kiblnd_dev_failover(kib_dev_t *dev)