[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87k03f5h83.fsf@kernel.org>
Date: Mon, 28 Nov 2022 15:41:32 +0200
From: Kalle Valo <kvalo@...nel.org>
To: Sascha Hauer <s.hauer@...gutronix.de>
Cc: Ping-Ke Shih <pkshih@...ltek.com>,
"linux-wireless\@vger.kernel.org" <linux-wireless@...r.kernel.org>,
Neo Jou <neojou@...il.com>,
Hans Ulli Kroll <linux@...i-kroll.de>,
Yan-Hsuan Chuang <tony0620emma@...il.com>,
"netdev\@vger.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
"kernel\@pengutronix.de" <kernel@...gutronix.de>,
Johannes Berg <johannes@...solutions.net>,
Alexander Hochbaum <alex@...udo.com>,
Da Xue <da@...re.computer>, Bernie Huang <phhuang@...ltek.com>,
Viktor Petrenko <g0000ga@...il.com>,
neo_jou <neo_jou@...ltek.com>
Subject: Re: [PATCH v3 07/11] rtw88: Add common USB chip support
Sascha Hauer <s.hauer@...gutronix.de> 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
Powered by blists - more mailing lists