Subject: Re: [PATCH v3 07/11] rtw88: Add common USB chip support

From: Kalle Valo <[email-masked]>
Date: Mon, 28 Nov 2022 15:41:32 +0200

Sascha Hauer <[email-masked]> 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