From patchwork Sun Jun 5 20:13:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 9156317 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 82C9C60759 for ; Sun, 5 Jun 2016 20:14:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74DAB2656B for ; Sun, 5 Jun 2016 20:14:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69D0C27C8F; Sun, 5 Jun 2016 20:14:28 +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 373E727B13 for ; Sun, 5 Jun 2016 20:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751780AbcFEUOH (ORCPT ); Sun, 5 Jun 2016 16:14:07 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33404 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751509AbcFEUOG (ORCPT ); Sun, 5 Jun 2016 16:14:06 -0400 Received: by mail-wm0-f66.google.com with SMTP id c74so3604518wme.0; Sun, 05 Jun 2016 13:14:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1M7u11q6t9pJHfTWAXbRCGce949XNOyGyDTuUbN2yVg=; b=ljwA+cwC8Pyro1mYCFUC4960VQ6dlowYWozexIa3YdWT6mdLJpkxjLNJN+L562e6bt c2MIsDixwAbmG6avZsvtfdvCAiSbC5sS2/KLij1Di1Esybgb6JUhC/yVPTR+uu0wB8Vf yoxQxckaZ8Yh62vFagYfmS0Pztfc+8Ij/omU6jIR4YgyXYR9QQ9YY5xmLkxOJOCW+UNb 1Qg/NLHL8QRIQDbd3a8mukOPvCgKIT76qYpD72MgI7hNo0O2/gVZalNMN3r56b7GjAtn ICzy59vZeICF1CefSFQkjPlxBhAf+X0bw5xp3/2t/tEByzQOLxa0Svwi6AKP3Vw7TdZb eHpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1M7u11q6t9pJHfTWAXbRCGce949XNOyGyDTuUbN2yVg=; b=VA5wnY9/cqLtWIFPk4lOkKeRu7T8zb1RdfZFjWzKv0ITdjCLEoAnJj228sN8IV+R1A AC5hJdRKF3zMK/Jih+6ZgtiOOUjvTMKdkvmrEkEFiplZq9bLrU/8GLTzsZoCEDozrZ++ q0f+5Vsn+rV19QGSFIXvP4FSm2DRRUJX/PJATju7lqpS+Xn3zZsgRQWdr+Gm5QlGPC4a ymbBiAOciPHD0VFCq9DtGJg8+0lyC4vVoL75Te0eDDdTsvBiE7HnZu0Qdv6PCdrOlR5i TtwPb1HmFjVmvaQbn+1ybN7VIqG72ZuaK7kfyCtQ1pNIxhr40IGiAHngwEtC1yE8h/Pq 8B0Q== X-Gm-Message-State: ALyK8tIuH8oyYSozSMfBjcD7qZgGqm9VWKDwFZmb+GzXVDwqXp1D3YJAn+4trnsDEbcSBA== X-Received: by 10.194.201.162 with SMTP id kb2mr13688417wjc.55.1465157644163; Sun, 05 Jun 2016 13:14:04 -0700 (PDT) Received: from sudip-laptop.lan (234.98.208.46.dyn.plus.net. [46.208.98.234]) by smtp.gmail.com with ESMTPSA id dd7sm16727587wjb.22.2016.06.05.13.14.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Jun 2016 13:14:03 -0700 (PDT) From: Sudip Mukherjee To: Doug Ledford , Sean Hefty , Hal Rosenstock Cc: linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Sudip Mukherjee Subject: [PATCH 2/2] IB/sysfs: fix memory leak Date: Sun, 5 Jun 2016 21:13:56 +0100 Message-Id: <1465157636-10120-2-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465157636-10120-1-git-send-email-sudipm.mukherjee@gmail.com> References: <1465157636-10120-1-git-send-email-sudipm.mukherjee@gmail.com> 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 the allocation of hsag fails we were just returning but stats was not released. Signed-off-by: Sudip Mukherjee Reviewed-by: Leon Romanovsky --- drivers/infiniband/core/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index fcf6f9c..8d8732c 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c @@ -906,7 +906,7 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port, sizeof(void *) * (stats->num_counters + 1), GFP_KERNEL); if (!hsag) - return; + goto err; ret = device->get_hw_stats(device, stats, port_num, stats->num_counters);