From patchwork Mon Sep 18 11:28:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 9956517 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 485AB60208 for ; Mon, 18 Sep 2017 11:28:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 381CB28A60 for ; Mon, 18 Sep 2017 11:28:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CE7628A76; Mon, 18 Sep 2017 11:28:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4726928A60 for ; Mon, 18 Sep 2017 11:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754950AbdIRL2z (ORCPT ); Mon, 18 Sep 2017 07:28:55 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:37668 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754662AbdIRL2z (ORCPT ); Mon, 18 Sep 2017 07:28:55 -0400 Received: by mail-wr0-f194.google.com with SMTP id u48so136093wrf.4; Mon, 18 Sep 2017 04:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=DeUZCvF3YOVrPGAvO3WMQ8xBHsdAiBzmWAdPRtYqglQ=; b=YpqofYQ9VeiwjqgCruxOYalowO6VwjEZ52jwUUX82x5IF9qx+flFuD2ew/PLd78KLl CDbXlPmISDiCGtAkDidnC1XASM6c5Y/KMaqCJgmX2Hb6QNaTX6uDlXvLTiMzsE0CI+uy BV5M+2qiGXVEk/4fS+YnOxuPRCQXsoshkLQkBl4NQbi3xOW1MPueDZUKvrm3ZDxEbaO6 PdOSK+Tl1wRR/aMlkDJP//zwikuCRE24iIj/qKOe0/K9IRtWkjvIKOySH8loA4EehBxb +XX9qA8EejcnK76GTz4speyGN4PnXjPav9efFcaLWbExIpMt1mgw+9POJpJax+Y94YD4 qLEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DeUZCvF3YOVrPGAvO3WMQ8xBHsdAiBzmWAdPRtYqglQ=; b=fFA3CtKWkgMuZrf6R3cxbKWiXOo175Hl+lnCa0DkKHS7GkdEAUZ5Ov7XwvErG8300v jIo0fpBXlEQoE67GqLo0VFvYxLvPyGAG7BJMXPxZ+ONO2KaroJyLyc4tfCYdBQRLJlfs 4xkb7bu5PDLSuNYQwVPp5pjs25Ev2IjVYKpKNE3V5YlaeL1Jl+yvnU8LTcYwYSFwQnde W0aAfsLw89AaWQybavbznBMYI0g4go8iaFEYyNmZ0W7QsJ5Jgh9gm3j8XwBi7O4vSnGB 23r4oRU1LC+YUieLm7P4COD4KFZfkiPLGQsGULyh5zufqxpOPvJaZxUPD1i0i7o3sER6 1ROA== X-Gm-Message-State: AHPjjUipd4R4zpE7bIB1dxZ7jywxmmUSK9YmPwXUrQo0M7qhrAJUf6ru vVaLOjxHaBNCFg== X-Google-Smtp-Source: ADKCNb6W53Zs4uHr71GSG30dTB50lVsEAm3ZoYvoyXCXn1nMEYNkm6cSOrZWwnc9NNYQGrn1E9Wq0Q== X-Received: by 10.223.144.71 with SMTP id h65mr28718877wrh.41.1505734133794; Mon, 18 Sep 2017 04:28:53 -0700 (PDT) Received: from sudip-tp.dyn.ducie.codethink.co.uk ([167.98.27.226]) by smtp.gmail.com with ESMTPSA id i8sm6790461wra.56.2017.09.18.04.28.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 04:28:53 -0700 (PDT) From: Sudip Mukherjee X-Google-Original-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 v2] IB/mlx5: fix debugfs cleanup Date: Mon, 18 Sep 2017 12:28:48 +0100 Message-Id: <1505734128-21708-1-git-send-email-sudip.mukherjee@codethink.co.uk> X-Mailer: git-send-email 2.1.4 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sudip Mukherjee 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. Fixes: 4a5fd5d2965c ("IB/mlx5: Add necessary delay drop assignment") Signed-off-by: Sudip Mukherjee Acked-by: Leon Romanovsky --- drivers/infiniband/hw/mlx5/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index ab3c562..05fb4bd 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -3837,11 +3837,13 @@ static int delay_drop_debugfs_init(struct mlx5_ib_dev *dev) if (!dbg) return -ENOMEM; + dev->delay_drop.dbg = dbg; + dbg->dir_debugfs = debugfs_create_dir("delay_drop", dev->mdev->priv.dbg_root); if (!dbg->dir_debugfs) - return -ENOMEM; + goto out_debugfs; dbg->events_cnt_debugfs = debugfs_create_atomic_t("num_timeout_events", 0400, @@ -3865,8 +3867,6 @@ static int delay_drop_debugfs_init(struct mlx5_ib_dev *dev) if (!dbg->timeout_debugfs) goto out_debugfs; - dev->delay_drop.dbg = dbg; - return 0; out_debugfs: