Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2992268rwb; Fri, 16 Dec 2022 08:51:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf7iG+XeUt/VIfcB0K/YBrwIrzhPNG6g97KMxxU1fxMSOArOBJdsMnmYyYnp11Er2VKRoIxP X-Received: by 2002:a17:902:bb8b:b0:185:4421:72cf with SMTP id m11-20020a170902bb8b00b00185442172cfmr32630686pls.20.1671209495379; Fri, 16 Dec 2022 08:51:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671209495; cv=none; d=google.com; s=arc-20160816; b=qXLr35JlMNLa16GNM5sv4Vh1GDRroPjLffSAqaCTGaHPgpufrfIv8u3h+oEABrZBZ2 RvVAAKHGzfkUseLq2b+4wyMPvTmFnjiw2BGXq7aEFpxBfjn8YS8KixsLCGX4zaFJwjh1 l0pHxEdvvmNOsfBOlzL8s+cfvqavXKn4uM90qcIvrfOpZ7X8XI88OzryglPzvPjxvBg2 YFSG/hSk8K6ZSxGTdbgPhZPJLUwpJCn3r3D6DmGkv3KIPfWehDyMi2G3sw6DI3O/ZBS0 29cPMFdiYkaBjg3czAKDrdf1y3Dvd8kBzKf4gTch0ieVPCpqoddrnYhBs8S6EAgkW5NB bq3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6KUkaPhFdhrJTbaSX6LPrBedEqwsNtmY+GCPOKSfpWQ=; b=wCiz/1PDFa5E9aXC3R2a5eAEV0BJgRpEaUnCGFG1AQ4B5XR9oTaGbssodbhxNr/UZE iXgB1ranRHll/hibjgBRNhqmczsFeSB2+c2Q7DzJ7sk6mS6+hnjc3pOF3IhaV/yEcWFW b5oWw+aAnNQLTF/AEBXhShb0H2UwfY7OqH7pIML6TcIqng+sea1l2fwPaBp696SRXbC+ eHaqXZ0zDGF5z6DylzrS5dcIuXmitCqz3W6yVo5scg+WJ9/0YtU1fVVchkLmZAHd88Jh OC2pQPPReSBlBEJX4BX+zcQNu3wCBW6ge207d4E1gIMM7jOraPONs0ZDGhS0+O7ReCGR I6Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mMnE57b0; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a170902da8e00b00180680b8f1bsi3328121plx.264.2022.12.16.08.51.22; Fri, 16 Dec 2022 08:51:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mMnE57b0; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230429AbiLPQsc (ORCPT + 66 others); Fri, 16 Dec 2022 11:48:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbiLPQs1 (ORCPT ); Fri, 16 Dec 2022 11:48:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DBE018E1D for ; Fri, 16 Dec 2022 08:48:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD938B81DD1 for ; Fri, 16 Dec 2022 16:48:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA999C433D2; Fri, 16 Dec 2022 16:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671209304; bh=jyl/zC15tNhZDmBGJE+3qLmjSeuFuNsHM8XNNGU5gQ8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mMnE57b0hxgZX7IWHY/j8UL+kmKQ24u24QvVKoQ2xy7jZAGERfkdn9XlHDaWH6s1k QfPOzaNEYXOqjhvO6cJA80XBKT93kVnZD/0tAL0g4DTeRhmoRzmR0T3hwvQKh7QMFY nanEVY9vpLxUBUi9E5tqrVozSx782+aL733UaAdf2dYPPUuv6Wr45C1pOj9od2gBSx B9ytBTqj4U12GIEmHfFZOz5NnobreAsCcA+7hjVOOaMH8uX1aTYghLiqXLW/nlGgmD CGmtjq1CZSshYJbPiKYMKErOKMyC/F2sYhXJdSLx0OVrQvpTVcFqNgaGSItnK0I9nA isctU2UWnCMUw== Date: Fri, 16 Dec 2022 17:48:20 +0100 From: Lorenzo Bianconi To: Bo Jiao Cc: Felix Fietkau , linux-wireless , Ryder Lee , Sujuan Chen , Shayne Chen , Evelyn Tsai , linux-mediatek Subject: Re: [PATCH] wifi: mt76: fix potential memory leakage Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="kytPndXVJDl+F4EW" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org --kytPndXVJDl+F4EW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > From: Bo Jiao >=20 > fix potential memory leakage, recycle rxwi when mt76_dma_add_buf() call f= ails. >=20 > Signed-off-by: Bo Jiao > --- > drivers/net/wireless/mediatek/mt76/dma.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wirel= ess/mediatek/mt76/dma.c > index fc24b35..9053344 100644 > --- a/drivers/net/wireless/mediatek/mt76/dma.c > +++ b/drivers/net/wireless/mediatek/mt76/dma.c > @@ -592,6 +592,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_qu= eue *q) > qbuf.len =3D len - offset; > qbuf.skip_unmap =3D false; > if (mt76_dma_add_buf(dev, q, &qbuf, 1, 0, buf, t) < 0) { > + mt76_put_rxwi(dev, t); I think we should add it even if page_frag_alloc or dma_map_single fail. Regards, Lorenzo > dma_unmap_single(dev->dma_dev, addr, len, > DMA_FROM_DEVICE); > skb_free_frag(buf); > --=20 > 2.18.0 >=20 --kytPndXVJDl+F4EW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCY5yhVAAKCRA6cBh0uS2t rBTHAP9ya7XWNqF0ld0OIGv50h74+PKRugcN9VCTYk8bV6qaUQEA+wPVmG/pCeCn jNfS+uiMW1sWTJOALvATPDJm+kvLswg= =3NtI -----END PGP SIGNATURE----- --kytPndXVJDl+F4EW--