Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2671821ybl; Thu, 29 Aug 2019 11:15:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDzNCKpM3SYD2YIKN5WqGKAzGdbktgRYmjJqV6aD8OgCmXiNTMrZSrrJkhditTUbaVhBWI X-Received: by 2002:a62:388f:: with SMTP id f137mr13285757pfa.131.1567102551880; Thu, 29 Aug 2019 11:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567102551; cv=none; d=google.com; s=arc-20160816; b=NNBFvWeqdq74i/psmiW9zs882MFHxe+AXqrNmHwePhxqfSQjAa8HTjCfDPbbhwBD1X 6/viv2yN10T28O/DVpZmi7D8ghNQWLyn9n8z6+JWTeO51bI/X//br0hZ3Ee4MrB5V4Ua H+fi2gg+J3ZNUM42HTVWjFrhziTngUoEMc+eHEA4cx0q42UGtCcyMb5snEK7He8v/4kB qT1o7BzDbNcs5Irhk7Q2XwupG63RlmSDM6a5DWDabVr0kX5YH6BQ/ler5vuSUQYUR2UJ iocePxri9JSGXEy/s8Q/AcHFbbvZJ9VUZ92Udm6Bam8ZFyzbs3BcwJyOM1eq2WsKpscE 65og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XNFRU0LJmRkPPODVfoDVfe2FMgudn2+hzLzujtszwGA=; b=NN4cUN6mM20rDcgsdcPmOhwI9MKOtNz3/1tZHYuQb693xAs5rg2VW9pgYnp9P3YmUo S0rjQeIw6VMXs+EtzCgqo8XR0DmdZzz0W0yKeKtU8Hty6oVpKhRVDw9PdRbeX53IUVdi HEV26UD65ocIGE/9gtkBzwAaTMoguXKiUlU4QT2zMBvbGws+6S5PGBRvgdmE90HetTvz 5EU5lEybt0dJbUt2zi0sYJxjllp8xRJEXFrrPGnK5RhBBN6vJvD/uk33GIYn3e/Yi/nZ /GZPnof/jh/n+Vk0IelZj45tf06/cbATyjm0A54gPRv5tx5Ne2YP7AfrBsETrDEmjeSs MjVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jqhjaBLS; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b16si2630121pgh.296.2019.08.29.11.15.36; Thu, 29 Aug 2019 11:15:51 -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=pass header.i=@kernel.org header.s=default header.b=jqhjaBLS; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728765AbfH2SOI (ORCPT + 99 others); Thu, 29 Aug 2019 14:14:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:55806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728715AbfH2SOE (ORCPT ); Thu, 29 Aug 2019 14:14:04 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D292723405; Thu, 29 Aug 2019 18:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567102443; bh=pVx0+T0uMre9RGLRRffv8Dz/qSSmktN8JSDjH9TDMuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jqhjaBLSCGu8bS2rEFrsewaYFKp/2Vs45ykjurG/djkR87TemeMi1fEWKA0MiABNk 1mfiD9/Iz+U3JEYpWigKQkZ/hr146PrTqgVF4Qf0KBxGrSFBwlCzJF79X1QDNnQDB3 MLyKE6HQ3GJ8B/QMeEwfHf+MQXlSUXd1OR3RLBjQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Wenwen Wang , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.2 31/76] cxgb4: fix a memory leak bug Date: Thu, 29 Aug 2019 14:12:26 -0400 Message-Id: <20190829181311.7562-31-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190829181311.7562-1-sashal@kernel.org> References: <20190829181311.7562-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wenwen Wang [ Upstream commit c554336efa9bbc28d6ec14efbee3c7d63c61a34f ] In blocked_fl_write(), 't' is not deallocated if bitmap_parse_user() fails, leading to a memory leak bug. To fix this issue, free t before returning the error. Signed-off-by: Wenwen Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c index 02959035ed3f2..d692251ee252c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c @@ -3236,8 +3236,10 @@ static ssize_t blocked_fl_write(struct file *filp, const char __user *ubuf, return -ENOMEM; err = bitmap_parse_user(ubuf, count, t, adap->sge.egr_sz); - if (err) + if (err) { + kvfree(t); return err; + } bitmap_copy(adap->sge.blocked_fl, t, adap->sge.egr_sz); kvfree(t); -- 2.20.1