Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp14855866rwb; Mon, 28 Nov 2022 05:44:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf5/8V1cMxIHXmoLdr6r7Tk8MROPs9KaXndMDowbIWDcM5uJVCsSyuhxCFOHlYKsl8Ml5O15 X-Received: by 2002:a63:4d61:0:b0:477:b1a8:531e with SMTP id n33-20020a634d61000000b00477b1a8531emr25409622pgl.158.1669643082607; Mon, 28 Nov 2022 05:44:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669643082; cv=none; d=google.com; s=arc-20160816; b=cdqqKzraNO1f8vtlWBIs/FTlOGdDQOYAL/4XENSogIS4/xsnAM7GwYEKZjxLjradFO 9QytLfIKifnUnhS2QoDFSh4cFLCC6eFMWebdukG118lPBkCYGBL3eY0T/rwpnoOevPLt Dr9TX+cBfDoaeZB5va/sXBd/MKUlL7wZr3rET3HPX2TIWuZWHw+KVqbb/iVWeEjgNQUF xKM8gveoQvejvOmzctLyW1y3aiH39DRjtg6bW9WVe1HXlFlHpNgpLLSRE71Qh7sWp/3I lxuLMcLShV9ZqR4/KPbcZo8npxnQb2PfWebdHflopjWg7zG9l/DOuJtYsLhR+XB6FH88 222A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=g6Wy8FTL//dV5Npew527fFNL/O+oHktAsaEIhbPInbo=; b=A0V7Z75NtxSRJfhlT7qwbSvXSdRulBk6jIpTsH2wY9N2SFiBshTO0nP4khVzsT2TVj miYo0/N5qLQ1XG1uWbFxaIUwptA4Vi7KbJnQSC/tbFhvAkDN2nP18abdVEhDKVJih+3S u1kCbPePFC1Tk1PzIhcgF06G3b5iBWYyN4CB/29hN3s53uUA7RiQZYZfL/B9ttMT4RZM HQMEL/z1tAygPEZSXlJO4t+XLBgNa/Qbmw4pdsHuk1PLKAt+QC2bEGEKCutppi/qhiH8 cMVJUgPJEK/Ne/pDkwVfmO3/y3gAB6M7VCn6TaovJRwG/1uLo/RTwqb5iUJB6rzsh27H v2OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pq2koBUP; 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 kb18-20020a17090ae7d200b00200642481bdsi13506192pjb.11.2022.11.28.05.44.34; Mon, 28 Nov 2022 05:44:42 -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=pq2koBUP; 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 S231815AbiK1Nlo (ORCPT + 67 others); Mon, 28 Nov 2022 08:41:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229870AbiK1Nlm (ORCPT ); Mon, 28 Nov 2022 08:41:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8CFEB49C; Mon, 28 Nov 2022 05:41:41 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 6530361178; Mon, 28 Nov 2022 13:41:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77F13C433D6; Mon, 28 Nov 2022 13:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669642900; bh=c9KYmmV9Jd7E1V1b9Z2sFp2dehpiB3Gp3kkqi97DJjw=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=pq2koBUPfrVFR5bI4zQUHJja9jhYBHuJ8E33Ed1D0ngr92jT+Bn+6TAJ4EIY2U78K KYFfQmjNQtzjXo+Sfl3dfVjWJq/UmptNWxAVfa73FuFn5sBoutzgtIxDfSHpt2tefB xF6wZhuI+N0GRsLBk5dz5iqElLk4+u97LrkiDstg1FAyxrbFR5RsLj2LWvmA5pIgID Wagn5RsiRRjHMu1Eh2MmmdK9Ozg2Y9XuPaqvw/l4LHOuAmNtn6Uj1i2uv98kPXKOFG v8V/nI7/dbuuKYVMUHgcWayHMtwuHHiJgVt/F5+OC65ZgMyWMIQpp86/TGoIeHWQgG O5mzVgBtsOJKQ== From: Kalle Valo To: Sascha Hauer Cc: Ping-Ke Shih , "linux-wireless\@vger.kernel.org" , Neo Jou , Hans Ulli Kroll , Yan-Hsuan Chuang , "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 v3 07/11] rtw88: Add common USB chip support References: <20221122145226.4065843-1-s.hauer@pengutronix.de> <20221122145226.4065843-8-s.hauer@pengutronix.de> <1f7aa964766c4f65b836f7e1d716a1e3@realtek.com> <20221128103000.GC29728@pengutronix.de> Date: Mon, 28 Nov 2022 15:41:32 +0200 In-Reply-To: <20221128103000.GC29728@pengutronix.de> (Sascha Hauer's message of "Mon, 28 Nov 2022 11:30:00 +0100") Message-ID: <87k03f5h83.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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 Sascha Hauer writes: >> > +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; >> > + >> > + while (true) { >> >> Is it possible to have a hard limit to prevent unexpected infinite loop? > > Yes, that would be possible, but do you think it's necessary? It's a common advice to have a limit for loops in kernel. > Each *txcb is used only once, It's allocated in rtw_usb_tx_agg_skb() and > &txcb->tx_ack_queue is filled with a limited number of skbs there. These > skbs is then iterated over in rtw_usb_write_port_tx_complete(), so I don't > see a way how we could end up in an infinite loop here. Everyone always say that their code is bugfree ;) More seriously though, even if it would be bugfree now someone else can add buggy code later. So much better to have a limit for the loop. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches