Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6079879ybe; Tue, 10 Sep 2019 13:12:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwig22mUCStMsU2yPdmGXu0bo3bbbEfzY6rxfkjdfkmvLJqHZ2c/zAYTVGfF+XrJUfxSaQ7 X-Received: by 2002:a05:6402:16d5:: with SMTP id r21mr4690453edx.71.1568146341666; Tue, 10 Sep 2019 13:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568146341; cv=none; d=google.com; s=arc-20160816; b=cEUGVhMoP9ysOffykxGC83xzAPdzeMzlDNpI+VwoFPNytvVUZX903CatVMK8E8aEpD WX9q3qy4cC/ykC05BCsQaoivKhRj4up2x6dKiGOkc03HFb10jYyOXk0dxA/aPOQMLewB eSVF6SqfibPvkXDInfAb+4tPyiuILoG2gUr8i/LhPia1ji5vPa13uHb0pkpTua9yv3hN +8iznkCcbhZtWajVK8ZHJ5jrv1Qk4FhIOVzqLFvxnQQ3DHPa/BmGK7ULvnzPMRiW1Be3 pRhFRrCfd0BJ17plzIF+fTxh3/BAr/wAgHzMIXwkfG8SIYL1JFAZ/RE6NPwFCH3E1wuf bceQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/p27UbLD478g0Pw+DyhCQT8kTsPXt8MVDySAD2RPU6c=; b=rJqbemZcpZORTlvdNZgbIIXNQwXtDuPVSMCB382GyaIKANr+7PzBvB5lmDkxjlH9jE ONp1MNC7uECBk0uiQCiePyullx/6o7LsXeYI0R5pyXZRcSY0uCZQPhkCOMj5nYaeLP8G XvfnSMyzoAjJL+KGh8DDPiRMd09zqLnZypzILjqhYxLZ7ITp5OiAzgjk8plrwCdjaX6a yU5WpYuygyi58SxZGuGrRc3ikkqIVsc/QnOP2OYuzEDEuY6TjnC4TXEd2gQYNdGJ0Bhe B/0O6h4wAp6aV0puU9MhIZnuLgzElj0TFSlj1YClkb0FcIN7XJgvvU5/9DlrvYR7p9bg Tasw== ARC-Authentication-Results: i=1; mx.google.com; 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 c30si10827554ejj.214.2019.09.10.13.11.57; Tue, 10 Sep 2019 13:12:21 -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; 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 S1729378AbfIINGq (ORCPT + 99 others); Mon, 9 Sep 2019 09:06:46 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:56116 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726640AbfIINGq (ORCPT ); Mon, 9 Sep 2019 09:06:46 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 1C60981FD3; Mon, 9 Sep 2019 15:06:30 +0200 (CEST) Date: Mon, 9 Sep 2019 15:06:43 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Wenwen Wang , "David S. Miller" , Sasha Levin Subject: Re: [PATCH 4.19 27/57] cxgb4: fix a memory leak bug Message-ID: <20190909130643.GC18869@amd> References: <20190908121125.608195329@linuxfoundation.org> <20190908121136.425579987@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="V88s5gaDVPzZ0KCq" Content-Disposition: inline In-Reply-To: <20190908121136.425579987@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --V88s5gaDVPzZ0KCq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun 2019-09-08 13:41:51, Greg Kroah-Hartman wrote: > [ Upstream commit c554336efa9bbc28d6ec14efbee3c7d63c61a34f ] >=20 > In blocked_fl_write(), 't' is not deallocated if bitmap_parse_user() fail= s, > leading to a memory leak bug. To fix this issue, free t before returning > the error. The code is quite strange ... it seems to use kvfree when free would be enough. Is that worth fixing? blocked_fl_read() seems to have same problem. Best regards, Pavel > 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(-) >=20 > 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; > =20 > err =3D bitmap_parse_user(ubuf, count, t, adap->sge.egr_sz); > - if (err) > + if (err) { > + kvfree(t); > return err; > + } > =20 > bitmap_copy(adap->sge.blocked_fl, t, adap->sge.egr_sz); > kvfree(t); --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --V88s5gaDVPzZ0KCq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl12TmMACgkQMOfwapXb+vLr7ACgrFqWKI1vmjVdxL7GjkyyFF9F RKgAnR2ZVLEjzTRxzR3wkxeI1Vyz1RMP =2REJ -----END PGP SIGNATURE----- --V88s5gaDVPzZ0KCq--