Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1480176

[PATCH] staging: ks7010: fix two memory leaks on error return path

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Colin King <colin.king@canonical.com>
Newsgroups linux.kernel
Subject [PATCH] staging: ks7010: fix two memory leaks on error return path
Date Fri, 09 Sep 2016 18:00:01 +0200
Message-ID <sfwnD-4Sy-9@gated-at.bofh.it> (permalink)
X-Original-To Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Wolfram Sang <wsa+renesas@sang-engineering.com>, Nicholas Mc Guire <hofrat@osadl.org>, devel@driverdev.osuosl.org
X-Mailer git-send-email 2.9.3
MIME-Version 1.0
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding 8bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 26
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org
X-Original-Date Fri, 9 Sep 2016 16:56:38 +0100
X-Original-Message-ID <20160909155638.19304-1-colin.king@canonical.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1480176

Show key headers only | View raw


From: Colin Ian King <colin.king@canonical.com>

On the error case where there is an invalid MAC address there is
memory leak on packet and pp on the error return. Free these first
before returning to fix the leak.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/staging/ks7010/ks_hostif.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index c5fc31c..e09df360 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1196,6 +1196,8 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet)
 		DPRINTK(1, "ethernet->h_source=%02X:%02X:%02X:%02X:%02X:%02X\n",
 			eth->h_source[0], eth->h_source[1], eth->h_source[2],
 			eth->h_source[3], eth->h_source[4], eth->h_source[5]);
+		dev_kfree_skb(packet);
+		kfree(pp);
 		return -3;
 	}
 
-- 
2.9.3

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] staging: ks7010: fix two memory leaks on error return path Colin King <colin.king@canonical.com> - 2016-09-09 18:00 +0200

csiph-web