Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp5816410rwj; Wed, 21 Dec 2022 07:24:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXuBz4TA7sS7BRpjiH1CxeLewJhTfhW4SeLNsJou7zgKmUbfRW1tGf4Zgnld5hNJ9qZGNF7o X-Received: by 2002:a17:906:2849:b0:7b8:882d:43ef with SMTP id s9-20020a170906284900b007b8882d43efmr1578410ejc.0.1671636241083; Wed, 21 Dec 2022 07:24:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671636241; cv=none; d=google.com; s=arc-20160816; b=XyyOsuj6VcXEQyCLMsTlNwz6oAIRgkxWrB4Ykw5Yo712BFwH0HMWZrWP/sRsNmeiqg OuD4PoYStFfBqBgwc8Ek8XtjyL8Nj5vZ7DBjiuOFMhr0ci/185aAjgGmbYwhw1+RgcQh UWJKLdEEy5XmFIihlRkmoXZkFMYWTLiStMs+HvUlY5+oTRCBp0qFvJewx1DgDZF05lus fvWf4O4zKxni0OXnCEwugqPLgbxCxyTZ5pZ7isXasBHPFHmkVcoRI4mKytgwACaQv4TI 4/h+iaPTdo/6wkMJMJdwUqToqo+MN5BtPFgv+L06diH1HOpfiu6bNPwPCNUZyACMd9xL L9wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:cc:references:message-id:date :subject:mime-version:from:content-transfer-encoding:dkim-signature; bh=JpPdxS7HiOoDJNdiv8R8Y64fgKbS8lj3lJjc7zmtKM4=; b=Ng8W5ntE5oPer0kVsKc/xp86mJXKNV++cS7RCmoKJgyfuZYwvNcLYlHX83fbrU54q0 7cDGQkPKvpPsfZkukWNLZwhZh1ScBoMYda+94juRQXwvRlojZkSEr6zoOV8+0XzW3xup upw+2pPBTOFVD/UmkXPs+8V8+MV6JvBMYPBRZgE5DEvd7mdsLRs+VEhRTZTqWaMWfXUf Db6P1KPRQWMtOakrStmNUkrODsyUFix/UelGVytTmieX96kJJY2lGQwCg/pohkw0IToq i/rbK1iZ8MA+z7WrtjBw5sfo+cTw+m3ZHGJ0D6q+B5cbgik5SkuFIeWVYelbT3wR8s+G 3WAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=R6gyhcmC; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vg9-20020a170907d30900b007c16fdc93c4si9530192ejc.676.2022.12.21.07.23.40; Wed, 21 Dec 2022 07:24:01 -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=fail header.i=@nbd.name header.s=20160729 header.b=R6gyhcmC; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231897AbiLUPM5 (ORCPT + 66 others); Wed, 21 Dec 2022 10:12:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbiLUPM4 (ORCPT ); Wed, 21 Dec 2022 10:12:56 -0500 Received: from nbd.name (nbd.name [46.4.11.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62D12295 for ; Wed, 21 Dec 2022 07:12:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=To:In-Reply-To:Cc:References:Message-Id:Date:Subject: Mime-Version:From:Content-Transfer-Encoding:Content-Type:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=JpPdxS7HiOoDJNdiv8R8Y64fgKbS8lj3lJjc7zmtKM4=; b=R6gyhcmCxqScr4Nw7fBtKffY4/ ngk90atnnkWBtIGVmt3lQ9Av4psV48AA5S1TxW4avTEpYl54rQgBD8MrPZetdIQ65x6yQYcPnFYbD fRuEL4uPKXo+/Xh2XDBx7sbObz5cAXEluhsciW51xsZBmmI40ZMVJu5YooLg78QUe59Q=; Received: from [2a01:598:b1a1:36a1:31bb:caaa:f244:59d0] (helo=smtpclient.apple) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1p80m3-00Abzx-3z; Wed, 21 Dec 2022 16:12:51 +0100 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable From: Felix Fietkau Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v2] wifi: mt76: fix potential memory leakage Date: Wed, 21 Dec 2022 16:12:40 +0100 Message-Id: References: <3940cc5ccb4b17d51b5176e722daef0d1af66d6a.camel@mediatek.com> Cc: lorenzo@kernel.org, linux-wireless@vger.kernel.org, Shayne Chen , Bo Jiao , Evelyn Tsai , Ryder Lee , linux-mediatek@lists.infradead.org In-Reply-To: <3940cc5ccb4b17d51b5176e722daef0d1af66d6a.camel@mediatek.com> To: Sujuan Chen X-Mailer: iPhone Mail (20B101) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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 Hi Sujuan, > Yes, it is so expensive, but if no memcopy, it will casue memory > fragmentation (we hit this issue in internal SQC). >=20 > as we know, wed needs to exchange rx pkt(belongs to wed rx buffer > manager) with wifi driver(dma rx data queue) by exchanging wfdma dmad > to ensure the free wed rx buffer. >=20 > it is possiable that a large number of buffer has been exchanged to wed > and can not come back to wlan driver. So, the memory from the same 32K > page cache is unable to be released, and it will be failed at > page_frag_alloc in mt76_dma_rx_fill. >=20 > Any ideas but memcopy? A simple solution would be to simply allocate single pages, or half-page fra= gments. - Felix