From patchwork Sun Mar 11 22:45:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 10274963 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 46217602C2 for ; Sun, 11 Mar 2018 22:45:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 313A328C9D for ; Sun, 11 Mar 2018 22:45:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22B2228CA4; Sun, 11 Mar 2018 22:45:53 +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.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI 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 BB80928C9D for ; Sun, 11 Mar 2018 22:45:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932350AbeCKWpc convert rfc822-to-8bit (ORCPT ); Sun, 11 Mar 2018 18:45:32 -0400 Received: from smtp02.smtpout.orange.fr ([80.12.242.124]:30881 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932290AbeCKWpb (ORCPT ); Sun, 11 Mar 2018 18:45:31 -0400 Received: from linux.numericable.fr ([77.198.79.136]) by mwinf5d55 with ME id LmlV1x00V2wTeBR03mlV2V; Sun, 11 Mar 2018 23:45:30 +0100 X-ME-Helo: linux.numericable.fr X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 11 Mar 2018 23:45:30 +0100 X-ME-IP: 77.198.79.136 From: Christophe JAILLET To: tariqt@mellanox.com Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] net/mlx4_en: Fix a memory leak in case of error in 'mlx4_en_init_netdev()' Date: Sun, 11 Mar 2018 23:45:29 +0100 Message-Id: <20180311224529.4427-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 X-Antivirus: Avast (VPS 180311-2, 11/03/2018), Outbound message X-Antivirus-Status: Clean 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 'kzalloc' fails, we must free some memory before returning. Fixes: 67f8b1dcb9ee ("net/mlx4_en: Refactor the XDP forwarding rings scheme") Signed-off-by: Christophe JAILLET --- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 8fc51bc29003..f9db018e858f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -3327,7 +3327,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, if (!priv->tx_cq[t]) { kfree(priv->tx_ring[t]); err = -ENOMEM; - goto out; + goto err_free_tx; } } priv->rx_ring_num = prof->rx_ring_num;