Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3483225rwb; Mon, 16 Jan 2023 08:34:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXvfelTF0zL31k+9WGupVtHKam0b4kWDjBSNbmKlKIAgiWA6ZfLOZkQO9rdXVyk506PVJA5f X-Received: by 2002:a17:90b:1888:b0:227:161a:6318 with SMTP id mn8-20020a17090b188800b00227161a6318mr30151869pjb.47.1673886855002; Mon, 16 Jan 2023 08:34:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673886854; cv=none; d=google.com; s=arc-20160816; b=SdqPQvefYt7AiNGX17sJUw7/YLkFSyOcspKy2BGUdujrQePULtjFRWcbTM0EHwM2Rp wvB4xVc2ukh21QXgaPGUmeIU5kqKTNWNK2vh1rRwi6pJFXgKu9GAL7WH+wFQ2ZRntBba NS7UePHkUCEAy6cI3po8sk3hXb09atWepmDhwkuz5SZ95t5XfYNVOIMuYgfUfWci11zn LKjdJYSD9alS7i/uQ5Qelkx5rrFH4GR2IWOq8/M9jv2C9nm3Zq9+VIUXFz9Xc+nssK/D hYWPNwTt3P9FlJh7Xj6pxQ0r9UiHHL5PyEqKLeyNyIDXJQancjvuVxj6LVbuK14WSWYP 2KWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dkim-signature; bh=SHSSuvAdOf5XP70/Z4mzakQ401IzoXC0FlMuw5rdFuU=; b=uaz+HJWh+i0jqZfGeRjoI8mjlBF+OyIIJB6QLjCTNR2KB1BXlZI7xWVDyRQkm3p202 YFVy0icAhV01K7XqqA5vRTJYAYSyQ0zzXkjBPSXSisLihs2YeW1shh7T7nYjQL/Zz12F ibuLOWYemxptsEFKcygAxcghZMLHs8eeGOFP4dawH1cFxxKrM6vFTsmuo58/2eEdOgyc /TX7Nwoh9t6t9oX+Z47+gubJ5/0sIBG+0hDD9NijY2J05XRrEKTr0B8OdWiaKESUkAt5 wtCkHoppLVl9miCo3IJSPMoOpRoVvZdHdL5cA1mDX63SFSPYA2G5B7GXaduFgdzvxjGT W9SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MxolUrj1; 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 f2-20020a63de02000000b00478d123065bsi28584402pgg.402.2023.01.16.08.34.02; Mon, 16 Jan 2023 08:34:14 -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=MxolUrj1; 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 S233148AbjAPQd7 (ORCPT + 63 others); Mon, 16 Jan 2023 11:33:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233333AbjAPQdN (ORCPT ); Mon, 16 Jan 2023 11:33:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 055BE21A14 for ; Mon, 16 Jan 2023 08:21:09 -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 AFDCDB80DC7 for ; Mon, 16 Jan 2023 16:21:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7332FC433EF; Mon, 16 Jan 2023 16:21:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673886066; bh=cqaDJ41YVlRONlaI0b6RAJYyi38MN0BUVuklxz49TD8=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=MxolUrj1xJOMU+dZu6tM/MRNbHsjym/6kOH5DLz9o0jLAsmiu/Q6tB+Qovhe+M6aP 9Vtb3AmPy9r2XsQ+IvFMJ8ynihfTG6FEJnDWo9hCEuYeYCKy5nDI0Lp210K1ptHPHl N1bDgoZ+YpcIe6hZ5+LphQYcuHLDiLpm/YeIHfQiSibtvtRfIwiXUZwD+L07zXbAOy dP36a5n9pxlrpRhAr1i8vsZFa7amh2GLluOR1c95EqAmTYQmztU5gWEpPTpprO0cqy UV981lOstAZqmOLQZluTXEyvCbjJYGdgVzVnDzYiNxeG0qw41nmWKjgthpWDyD9RDr eMMzBIFv7D2rQ== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH] wifi: rtl8xxxu: Fix memory leaks with RTL8723BU, RTL8192EU From: Kalle Valo In-Reply-To: <03b099c1-c671-d252-36f4-57b70d721f9d@gmail.com> References: <03b099c1-c671-d252-36f4-57b70d721f9d@gmail.com> To: Bitterblue Smith Cc: "linux-wireless@vger.kernel.org" , Jes Sorensen , Ping-Ke Shih User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-ID: <167388606133.5321.1497309013061929727.kvalo@kernel.org> Date: Mon, 16 Jan 2023 16:21:05 +0000 (UTC) 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 Bitterblue Smith wrote: > The wifi + bluetooth combo chip RTL8723BU can leak memory (especially?) > when it's connected to a bluetooth audio device. The busy bluetooth > traffic generates lots of C2H (card to host) messages, which are not > freed correctly. > > To fix this, move the dev_kfree_skb() call in rtl8xxxu_c2hcmd_callback() > inside the loop where skb_dequeue() is called. > > The RTL8192EU leaks memory because the C2H messages are added to the > queue and left there forever. (This was fine in the past because it > probably wasn't sending any C2H messages until commit e542e66b7c2e > ("wifi: rtl8xxxu: gen2: Turn on the rate control"). Since that commit > it sends a C2H message when the TX rate changes.) > > To fix this, delete the check for rf_paths > 1 and the goto. Let the > function process the C2H messages from RTL8192EU like the ones from > the other chips. > > Theoretically the RTL8188FU could also leak like RTL8723BU, but it > most likely doesn't send C2H messages frequently enough. > > This change was tested with RTL8723BU by Erhard F. I tested it with > RTL8188FU and RTL8192EU. > > Reported-by: Erhard F. > Tested-by: Erhard F. > Link: https://bugzilla.kernel.org/show_bug.cgi?id=215197 > Fixes: e542e66b7c2e ("rtl8xxxu: add bluetooth co-existence support for single antenna") > Signed-off-by: Bitterblue Smith > Reviewed-by: Ping-Ke Shih Patch applied to wireless-next.git, thanks. b39f662ce164 wifi: rtl8xxxu: Fix memory leaks with RTL8723BU, RTL8192EU -- https://patchwork.kernel.org/project/linux-wireless/patch/03b099c1-c671-d252-36f4-57b70d721f9d@gmail.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches