Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1346238ybp; Fri, 4 Oct 2019 13:18:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUSklwYH2Txbhoso+k0JvaS5eABzYRPKwYxGNAn0yqCR1ZEnQOadekoPhx6EmqLv3rxnQq X-Received: by 2002:a17:906:3298:: with SMTP id 24mr14129160ejw.136.1570220308149; Fri, 04 Oct 2019 13:18:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570220308; cv=none; d=google.com; s=arc-20160816; b=X+nh5B+PvQJq1FlkBO85K1quI1mpnvEmJ4IKKS3sYtDPWbMNxYfs5X237AtbXgjmm4 XjnA5ZLHiIdrIySPVKK9tamQgNH6f9L/SxxfMk/COWRVnAOq08rAQZXR3KrjyQa7V1AA 3IEHx9w7E/79cSFDygaJjAVE7KEMLxv+3tXcYFtHw1W5GM29+8Xl2nQHqP0CoJNvnwis 6aOXIb7JlSz3QjARWlW2hNR2O0cyG6dGIc5aNmGNkWVAaeuUQ94FAwaPZxO7zQqMICx3 W2coVx0o0OjuSOq4CTdUE8OR2oCZbAQX3L77fqZ3cCarIbj29ikarqAw3b7pis8QL2sA xdMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature; bh=hT/oExY7ats1AqepuNnxgrg+W5xUde0ZFah/AwhjxeA=; b=WkhGlJZvS+JvKSbeSGUDQnpVFql7FFpSrkEnf9Oom+Qx8y/hyCB7BNB41E1jF7TTKP +QeZyXR4DxnxDuAnmK7TjsTe/U0zVPLGoqyyCLpRVZXIGCox0AKxSvh09aGDsViqxWDt VdC/8iLHnmT8zc/7ON6X4njSjy79o78sopZx8HUWgCMmauy0UQ4gV62/WzdtO9fxeycz cNa95DViTlex5XeZxdPSyXjwcifsUYBzE6gwtWHP7f/80xlHhqcW3+0/2z7NuhOwDjpd rbUkTesAYAcfdn88ZPrZYmroOJl1/GRNU11Fv2vUpvmuaQUzSgurl/h8ImK6BCXt+G0G wJ4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=eKzyOkdw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j51si4231951ede.301.2019.10.04.13.18.04; Fri, 04 Oct 2019 13:18:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=eKzyOkdw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731348AbfJDURA (ORCPT + 99 others); Fri, 4 Oct 2019 16:17:00 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:38177 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727978AbfJDUQ7 (ORCPT ); Fri, 4 Oct 2019 16:16:59 -0400 Received: by mail-io1-f66.google.com with SMTP id u8so16270784iom.5; Fri, 04 Oct 2019 13:16:59 -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=hT/oExY7ats1AqepuNnxgrg+W5xUde0ZFah/AwhjxeA=; b=eKzyOkdwTVgDQ2K7yVdvbQpQ2Y5o9gQHjf1ZLs/0TtknuoSEf88gRE3B/VgSXRe2nM MaPWiP+DFmtmMOa4V+/fIXuzmU7h0LfbH92QwqYCh6xpzlPF6Y4etarqtYGFwcN8YIFh KTbhy9t0/3m87L4UKRDIPV+aiyoEDLA1YrY+pxytqsh/8wTp82JG4WTVt4pgwk2YsDFT TYQK7y3xY2D8O2nwUROYE+zlwF6oua9EA/ixXRVx4CRlh/lRFc124Qw5TlMD2GZdMIPJ 3GHq32K5Z1F8XMQnUSU6+WxybmUN18B736DtQMDHjjnt70M8oCb/qgoMbH3Bx6xDBx4t mwIQ== 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=hT/oExY7ats1AqepuNnxgrg+W5xUde0ZFah/AwhjxeA=; b=OCKRhcqw7kz4tZ/5U2VB84zj0RK/HtQHQ0/BUR0GLJMYOM7HJ1WBdSXnPtJs7UfIX1 +C4Eq7PaUUpYg+OTWL+BOB7HpPh2AWvmoN/pElS49IYwKCcF9gUb/yfz1ZPSZBZrILg5 pLgkiiBqoKOaUgVMzBGUs53mAhE7h0RuUDK3i3lptARoQDhVnRCk3HW6uz9G1pjCG6+m nOC9rnGsphMQZ30AbdG6u8z1oVH+F63nWumldsiz4sNMs++qwDXS5a9ho2EjS9cZwCnL c3V0vn5HgDqWWVwakE75xEnYAmApdEOC+BtAw6/zMFPMGWoDI98gN1u2ej7Ig6VZ3sDY GmXA== X-Gm-Message-State: APjAAAUvXc/AEaa09LdQbBGOHXwA82YLzxvRaRqZB1BY9YQoSNU4yJRa 7zybbZ/DYfKfmszLK0NP4Vs= X-Received: by 2002:a6b:6e02:: with SMTP id d2mr5637516ioh.8.1570220218662; Fri, 04 Oct 2019 13:16:58 -0700 (PDT) Received: from cs-dulles.cs.umn.edu (cs-dulles.cs.umn.edu. [128.101.35.54]) by smtp.googlemail.com with ESMTPSA id o5sm2830180ilc.68.2019.10.04.13.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2019 13:16:58 -0700 (PDT) From: Navid Emamdoost Cc: emamd001@umn.edu, kjlu@umn.edu, smccaman@umn.edu, Navid Emamdoost , Amitkumar Karwar , Nishant Sarmukadam , Ganapathi Bhat , Xinming Hu , Kalle Valo , "David S. Miller" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring Date: Fri, 4 Oct 2019 15:16:48 -0500 Message-Id: <20191004201649.25087-1-navid.emamdoost@gmail.com> X-Mailer: git-send-email 2.17.1 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In mwifiex_pcie_init_evt_ring, a new skb is allocated which should be released if mwifiex_map_pci_memory() fails. The release for skb and card->evtbd_ring_vbase is added. Fixes: 0732484b47b5 ("mwifiex: separate ring initialization and ring creation routines") Signed-off-by: Navid Emamdoost --- drivers/net/wireless/marvell/mwifiex/pcie.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index eff06d59e9df..096334e941a1 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -687,8 +687,11 @@ static int mwifiex_pcie_init_evt_ring(struct mwifiex_adapter *adapter) skb_put(skb, MAX_EVENT_SIZE); if (mwifiex_map_pci_memory(adapter, skb, MAX_EVENT_SIZE, - PCI_DMA_FROMDEVICE)) + PCI_DMA_FROMDEVICE)) { + kfree_skb(skb); + kfree(card->evtbd_ring_vbase); return -1; + } buf_pa = MWIFIEX_SKB_DMA_ADDR(skb); -- 2.17.1