Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4109700ybe; Mon, 9 Sep 2019 04:28:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZ7iwO/D3mDloHxNJmMRZ1lhfIF/JaP+TDRiBhBQQ4+XTyql1iB3fFYfwC7TVixsjWekHr X-Received: by 2002:a50:da02:: with SMTP id z2mr23659845edj.254.1568028531709; Mon, 09 Sep 2019 04:28:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568028531; cv=none; d=google.com; s=arc-20160816; b=MxfjX2tV7vUkpA3Plg0ejY/tOL0Qz893qAtAgxmJJTkJVMuo73qPhRLETfxdDlXdRT YlSnYf2djf2XPI+hbNZm9lolXId5+aTcOR5hL9WRW/Mux+GkZfxot/xYJTNN5WsDQPRv NXQ2hiGIYhFzcZcjrnlFhVPM+UxqOv4FRRfYwVMmIG5VmG3ADGqxyzn8c/NAxXuuCWmc mWa8Dy4E5rbso2HwPOUwXSGoT0n1eYU2yv1Oy3mt/Pui5Kv+RFR87MhwSVyuthYh4jf6 ElUzIWX0+p5ZUb8gFIqNFwgZ5QrwQWfSYEL5Fazlch8iBUwj3W8B8ypUXfI8LpRDQtlb dXug== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w/cD4rW1SmLcqRrwzr0d6AZkyzEx4prgp4SJDQ2fDes=; b=z+wg7C3RJiKfS1eRJzBw4fGP7wnxxj8yMDWGL4luQSeEpktu8hRC3t4LA1mZuofBU7 54wXAEGZFU9Sidpl6aNytqzQ+y+zTvhHY50j14t0iyFs4ACJW9ZnbSY1qCOJ8e/PyewM jGkxER0qZmDKiP+rmy9kuphABBqh2w8FbbT2T4KdnVGIEHn6TeND58Tqht3ZehHp+XHj 8iQTVhII8Q0apWpvCsvLddBwQ/rvUQd5lMgPdfOuedrN5gQ2bNcN3ZR/uzzr96QckEF2 ClzZ6M5Unj8ZZ/0m+wkBQtnpUcxO2Sk+uR+YbOZMUm6EUmJKRi3gIlloRAGMOweJndpi OIpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NoOMkTXs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i40si8052893eda.225.2019.09.09.04.28.28; Mon, 09 Sep 2019 04:28: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=NoOMkTXs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730779AbfIHMro (ORCPT + 99 others); Sun, 8 Sep 2019 08:47:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:36212 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730759AbfIHMrk (ORCPT ); Sun, 8 Sep 2019 08:47:40 -0400 Received: from localhost (unknown [62.28.240.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DF43F218AC; Sun, 8 Sep 2019 12:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567946860; bh=GSoye/YM6Rzkiq60yfP+e/AqbnEbrCA1QzAJqPhhZ1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NoOMkTXsSMUuyCgdIVQ1cjiptedJw+8SBf8LP3NhQ4fjLfx0+3A0VhL7GirZPoLbi kCG/vPMPhHJ9InU6nKnXIEggJkwwOUmjyKjNI3+XJHzGOTz/Mgedd4aR1CcHUkS8ne TlX2xJeGyYrMPoVcBz1bdGKlwroX2xutQexyXiWc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenwen Wang , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 27/57] cxgb4: fix a memory leak bug Date: Sun, 8 Sep 2019 13:41:51 +0100 Message-Id: <20190908121136.425579987@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190908121125.608195329@linuxfoundation.org> References: <20190908121125.608195329@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ 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 0f72f9c4ec74c..b429b726b987b 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c @@ -3276,8 +3276,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