From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CBA8C4321E for ; Wed, 30 Nov 2022 08:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234430AbiK3INh convert rfc822-to-8bit (ORCPT ); Wed, 30 Nov 2022 03:13:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233470AbiK3INe (ORCPT ); Wed, 30 Nov 2022 03:13:34 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A56914FF9D for ; Wed, 30 Nov 2022 00:13:33 -0800 (PST) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p0IDe-0008Il-7F; Wed, 30 Nov 2022 09:13:26 +0100 Received: from sha by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1p0IDb-000671-Bb; Wed, 30 Nov 2022 09:13:23 +0100 Date: Wed, 30 Nov 2022 09:13:23 +0100 From: Sascha Hauer To: Ping-Ke Shih Cc: "linux-wireless@vger.kernel.org" , Neo Jou , Hans Ulli Kroll , Yan-Hsuan Chuang , Kalle Valo , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Martin Blumenstingl , "kernel@pengutronix.de" , Johannes Berg , Alexander Hochbaum , Da Xue , Bernie Huang , Viktor Petrenko , neo_jou Subject: Re: [PATCH v4 07/11] wifi: rtw88: Add common USB chip support Message-ID: <20221130081323.GE29728@pengutronix.de> References: <20221129100754.2753237-1-s.hauer@pengutronix.de> <20221129100754.2753237-8-s.hauer@pengutronix.de> <4eee82341ef84d4aa063edeb6f23a70d@realtek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <4eee82341ef84d4aa063edeb6f23a70d@realtek.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Wed, Nov 30, 2022 at 01:40:36AM +0000, Ping-Ke Shih wrote: > > > > -----Original Message----- > > From: Sascha Hauer > > Sent: Tuesday, November 29, 2022 6:08 PM > > To: linux-wireless@vger.kernel.org > > Cc: Neo Jou ; Hans Ulli Kroll ; Ping-Ke Shih ; > > Yan-Hsuan Chuang ; Kalle Valo ; netdev@vger.kernel.org; > > linux-kernel@vger.kernel.org; Martin Blumenstingl ; > > kernel@pengutronix.de; Johannes Berg ; Alexander Hochbaum ; > > Da Xue ; Bernie Huang ; Viktor Petrenko ; > > Sascha Hauer ; neo_jou > > Subject: [PATCH v4 07/11] wifi: rtw88: Add common USB chip support > > > > Add the common bits and pieces to add USB support to the RTW88 driver. > > This is based on https://github.com/ulli-kroll/rtw88-usb.git which > > itself is first written by Neo Jou. > > > > Signed-off-by: neo_jou > > Signed-off-by: Hans Ulli Kroll > > Signed-off-by: Sascha Hauer > > --- > > > +static void rtw_usb_write_port_tx_complete(struct urb *urb) > > +{ > > + struct rtw_usb_txcb *txcb = urb->context; > > + struct rtw_dev *rtwdev = txcb->rtwdev; > > + struct ieee80211_hw *hw = rtwdev->hw; > > + int max_iter = RTW_USB_MAX_XMITBUF_SZ; > > + > > + while (true) { > > + struct sk_buff *skb = skb_dequeue(&txcb->tx_ack_queue); > > + struct ieee80211_tx_info *info; > > + struct rtw_usb_tx_data *tx_data; > > + > > + if (!skb) > > + break; > > + > > + if (!--max_iter) { > > Don't you need to free 'skb'? or you should not dequeue skb in this situation? My first reaction here was to call skb_queue_purge(), but that is implemented as: while ((skb = skb_dequeue(list)) != NULL) kfree_skb(skb); So basically it brings us into the same endless loop we are trying to break out here. If it was me I would just remove this check. *txcb is allocated once in rtw_usb_tx_agg_skb(), &txcb->tx_ack_queue is added the number of skbs that fit into RTW_USB_MAX_XMITBUF_SZ and here we dequeue these skbs again. No other code even has the pointer to add skbs to this queue concurrently. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |