Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3359831ybt; Tue, 30 Jun 2020 00:18:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZguILKebgL71kSZ6DbMeixTHNu7G8OmMY8v5FWFmvEgbgeUyGRsmxIwwmRCTKjXqlaoEg X-Received: by 2002:a17:906:3c56:: with SMTP id i22mr5287343ejg.12.1593501525004; Tue, 30 Jun 2020 00:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593501524; cv=none; d=google.com; s=arc-20160816; b=TLB2uZAo3xmujYwBtqYYyIvFCUOhJhOtEnJ2nYhojZOam9mj4LybvteaaLWnzPe+xf z3CJo5GyRpjVnJPYQDl3WJf1uUWpNrgdXtSxRGOkJ+CN/goz/5w7lQ05ETFXE5Iwkbkg xuK5UyHZ4/+F/IF30meldS3w/Cm57pcJoxAVreYabmoII62JkFrQ9h6LXEHgg3pD2sQL 2D+sMaF7L+saT1KdXaggje25NjuATfmPs43RrUbTAbYDqX8Ry58v3El56l3KaNZqL9Aa d/AxxnHrKruMBMk5id9ogjM0wk0fp1RtgehOxk6JSTyXyH6BuK/0Rr6K6jGQDwJ8eheg tg2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=o5BXBkRaf5P/zELbZtpZhieDpblAv4fABSjTvSf+zkI=; b=ipXyHY5iRdozJS3f8hOmHThfWnQbKRw8b/gU8MDV5iOfhu2ZJuJ8IJeZL4/MggcHJw vg0r6ZnC9RjaAout8aT3lPfPllJVSEnTzZd7blpv/6DuH/TpwSNS0UG/k/1uQnVA83KH LLZtebU07PyDBOVWTNP83ajjmwJqzCcANZ1yVf3kspYoFKDoiPSRqmrJfJLkdY2ByT0i PvsOzfRY5hdkBt4l9l4y+bF/2WZjOOF+9br3yoj9HXxim58NNLK78FKxcKfzDPTHkGXl aQjNscy/kUdemrUZTsq3oxgCCycBGpI9Df0EYs1kLdtIT6qQxTVRHt2+12HcH56dzgAi 6Yfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QTc7sF9d; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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. [23.128.96.18]) by mx.google.com with ESMTP id p26si1194663edy.181.2020.06.30.00.18.22; Tue, 30 Jun 2020 00:18:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QTc7sF9d; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 S1730705AbgF3HRG (ORCPT + 99 others); Tue, 30 Jun 2020 03:17:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:43636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730636AbgF3HRG (ORCPT ); Tue, 30 Jun 2020 03:17:06 -0400 Received: from localhost (unknown [151.48.138.186]) (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 67F2F2073E; Tue, 30 Jun 2020 07:17:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593501426; bh=5synz2C3U8p1pf1ipeeJ9gOueO9mxDSTwbasc+QhT74=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QTc7sF9dri+9YwUbUHXmXr2Y/sQZhmYmAVlC7jghbeRA8/Jz2fy95Lv4DsSVDu1NI TZPhXe26/2or6G3dNUUx8zOEMo/yqqNoxUC2pqe/BDFsBIFx90dcKOKAjHLLzAp3C/ 5Hs79htAzqv9egFUqOZU7ap90JhU0O7ZqNDG69c4= Date: Tue, 30 Jun 2020 09:17:01 +0200 From: Lorenzo Bianconi To: sean.wang@mediatek.com Cc: nbd@nbd.name, lorenzo.bianconi@redhat.com, ryder.lee@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH 3/3] mt76: mt7615: fix potential memory leak in mcu message handler Message-ID: <20200630071701.GC2169@localhost.localdomain> References: <5e8786d9cf0ccd09dd9c13c24c48ce441afbf0ff.1593491298.git.sean.wang@mediatek.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="32u276st3Jlj2kUU" Content-Disposition: inline In-Reply-To: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org --32u276st3Jlj2kUU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > From: Sean Wang >=20 > Fix potential memory leak in mcu message handler on error condition. >=20 Acked-by: Lorenzo Bianconi > Fixes: 0e6a29e477f3 ("mt76: mt7615: add support to read temperature from = mcu") > Signed-off-by: Sean Wang > --- > drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/ne= t/wireless/mediatek/mt76/mt7615/mcu.c > index 1b46cccd93c5..58e3838a3dba 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c > @@ -183,8 +183,10 @@ mt7615_mcu_parse_response(struct mt7615_dev *dev, in= t cmd, > struct mt7615_mcu_rxd *rxd =3D (struct mt7615_mcu_rxd *)skb->data; > int ret =3D 0; > =20 > - if (seq !=3D rxd->seq) > - return -EAGAIN; > + if (seq !=3D rxd->seq) { > + ret =3D -EAGAIN; > + goto out; > + } > =20 > switch (cmd) { > case MCU_CMD_PATCH_SEM_CONTROL: > @@ -215,6 +217,7 @@ mt7615_mcu_parse_response(struct mt7615_dev *dev, int= cmd, > default: > break; > } > +out: > dev_kfree_skb(skb); > =20 > return ret; > --=20 > 2.25.1 --32u276st3Jlj2kUU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCXvrm6gAKCRA6cBh0uS2t rDXrAPsGccYGcgDDRw98f6tuG0QktsFKLRJItNtuQG+mGY2YjgEA4FLMj9tcQOx3 Mz+xeYKB+byp9MDd87Yju/h2fQV1Xws= =zdsp -----END PGP SIGNATURE----- --32u276st3Jlj2kUU--