From patchwork Sun Sep 17 12:28:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 9954799 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 1B61260352 for ; Sun, 17 Sep 2017 12:28:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11B4F2880D for ; Sun, 17 Sep 2017 12:28:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04CD228B28; Sun, 17 Sep 2017 12:28:22 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 A526C2880D for ; Sun, 17 Sep 2017 12:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750861AbdIQM2U (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 Received: by mail-wr0-f195.google.com with SMTP id g50so3613997wra.3; Sun, 17 Sep 2017 05:28:18 -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=VMrn23lKBmRBjHWWYabav9SCB4hvOdhgZgMPBmYnxWw=; b=TNKeMUQL5d+Q/pUXgj2XFJPdmZBjbYoC9KZwPg6cDUORsew9i76N0gL9xj4prths+x WxUBB2jdKAYlTOWeSr3jEtiGcDP6mMfvv/9NZk4w5yPFSWUJhIdEP2P6PkBej2FrP/vA iwPi+zE4Vb16fEr268ZEySww+e4h9F1wIYSrWdEm0gax4To6taSnW1pA1qD2oOYJqAFp vJJIPloY3Rs+K7x9o3/s31xnwUbbtD9ZcYInQAn2Og1eHh2bQ3hZYaNQcPfUUOIa/+E3 8L/LDD6Q7N+11PAC6pRsaSJJWKazQTG/NgjgjmPTgSh+bNYkEhUBE/A55Qf4F2bGADZt UCkw== 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=VMrn23lKBmRBjHWWYabav9SCB4hvOdhgZgMPBmYnxWw=; b=NADFU/SkW0NnmKLLj2z2H3gSu7i4Ent5/JgaQatmwPmnhbvocHRlTjhIUatFErSond fW0Y+38bZJ7HJVUIqlzNqkNVUKAVzWsDq1hkfhvDve1RNIpCdE9o57CZIA9mDKBxUYbk S+ODg9ZQoNif8I52OJ1mMROr6RKwFXFqNlzRNCfgFlcwpCOFKSN6VXnFvB5p6dhB2Wgn 0HBFE8CtMkWNvs8tAM7aA2N5z6Ms2/LOUkB2sPCw+P4DdBM8gB0HSfYN3YiU05YDId5c 9s3YBCaqtITGQZtCVUPxvMF2udx3Db1uueIxzgjz201783/knoDfpPj0syX78DzG0wq3 yGnQ== X-Gm-Message-State: AHPjjUhZbJ20+R95XMV3xadw4QXTHaRCH6XztGgVTyjIbeYY2+QZWDZT NFdjpDPvtt0LRQ== X-Google-Smtp-Source: ADKCNb4jZL40pkuZIXclCn9NInhYg8437yUR04kv+K1sqahj7wIGryKkaK7c0Qj9HW3l3jcasN+afA== X-Received: by 10.223.160.119 with SMTP id l52mr25129930wrl.53.1505651297837; Sun, 17 Sep 2017 05:28:17 -0700 (PDT) Received: from localhost.localdomain (cpc101300-bagu16-2-0-cust362.1-3.cable.virginm.net. [86.21.41.107]) by smtp.gmail.com with ESMTPSA id w4sm4585668wrc.78.2017.09.17.05.28.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 Sep 2017 05:28:17 -0700 (PDT) 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-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }