Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751390AbdIQM2U (ORCPT ); Sun, 17 Sep 2017 08:28:20 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:36592 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803AbdIQM2T (ORCPT ); Sun, 17 Sep 2017 08:28:19 -0400 X-Google-Smtp-Source: ADKCNb4jZL40pkuZIXclCn9NInhYg8437yUR04kv+K1sqahj7wIGryKkaK7c0Qj9HW3l3jcasN+afA== From: Sudip Mukherjee To: Matan Barak , Leon Romanovsky , Doug Ledford , Sean Hefty , Hal Rosenstock Cc: linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Sudip Mukherjee Subject: [PATCH] IB/mlx5: fix debugfs cleanup Date: Sun, 17 Sep 2017 13:28:08 +0100 Message-Id: <1505651288-4781-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 894 Lines: 26 If delay_drop_debugfs_init() fails in any of the operations to create debugfs, it is calling delay_drop_debugfs_cleanup() as part of its cleanup. But delay_drop_debugfs_cleanup() checks for 'dbg' and since we have not yet pointed 'dbg' to the debugfs we need to cleanup the cleanup fails and we are left with stray debugfs elements and also a memory leak. Signed-off-by: Sudip Mukherjee --- drivers/infiniband/hw/mlx5/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index ab3c562..fba1920a 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -3870,6 +3870,7 @@ static int delay_drop_debugfs_init(struct mlx5_ib_dev *dev) return 0; out_debugfs: + dev->delay_drop.dbg = dbg; delay_drop_debugfs_cleanup(dev); return -ENOMEM; } -- 2.7.4