All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rt2x00usb: mark device removed when get ENOENT usb error
@ 2017-11-09 10:59 Stanislaw Gruszka
  2017-11-09 11:58 ` Richard Genoud
  2017-11-10  2:32 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Stanislaw Gruszka @ 2017-11-09 10:59 UTC (permalink / raw)
  To: linux-wireless; +Cc: Richard Genoud

ENOENT usb error mean "specified interface or endpoint does not exist or
is not enabled". Mark device not present when we encounter this error
similar like we do with ENODEV error.

Otherwise we can have infinite loop in rt2x00usb_work_rxdone(), because
we remove and put again RX entries to the queue infinitely.

We can have similar situation when submit urb will fail all the time
with other error, so we need consider to limit number of entries
processed by rxdone work. But for now, since the patch fixes
reproducible soft lockup issue on single processor systems
and taken ENOENT error meaning, let apply this fix.

Patch adds additional ENOENT check not only in rx kick routine, but
also on other places where we check for ENODEV error.

Reported-by: Richard Genoud <richard.genoud@gmail.com>
Debugged-by: Richard Genoud <richard.genoud@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
index e2f4f5778267..086aad22743d 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
@@ -57,7 +57,7 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev,
 		if (status >= 0)
 			return 0;
 
-		if (status == -ENODEV) {
+		if (status == -ENODEV || status == -ENOENT) {
 			/* Device has disappeared. */
 			clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
 			break;
@@ -321,7 +321,7 @@ static bool rt2x00usb_kick_tx_entry(struct queue_entry *entry, void *data)
 
 	status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
 	if (status) {
-		if (status == -ENODEV)
+		if (status == -ENODEV || status == -ENOENT)
 			clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
 		set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
 		rt2x00lib_dmadone(entry);
@@ -410,7 +410,7 @@ static bool rt2x00usb_kick_rx_entry(struct queue_entry *entry, void *data)
 
 	status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
 	if (status) {
-		if (status == -ENODEV)
+		if (status == -ENODEV || status == -ENOENT)
 			clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
 		set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
 		rt2x00lib_dmadone(entry);
-- 
2.7.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rt2x00usb: mark device removed when get ENOENT usb error
  2017-11-09 10:59 [PATCH] rt2x00usb: mark device removed when get ENOENT usb error Stanislaw Gruszka
@ 2017-11-09 11:58 ` Richard Genoud
  2017-11-10  2:32 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Genoud @ 2017-11-09 11:58 UTC (permalink / raw)
  To: Stanislaw Gruszka, linux-wireless

On 09/11/2017 11:59, Stanislaw Gruszka wrote:
> ENOENT usb error mean "specified interface or endpoint does not exist or
> is not enabled". Mark device not present when we encounter this error
> similar like we do with ENODEV error.
> 
> Otherwise we can have infinite loop in rt2x00usb_work_rxdone(), because
> we remove and put again RX entries to the queue infinitely.
> 
> We can have similar situation when submit urb will fail all the time
> with other error, so we need consider to limit number of entries
> processed by rxdone work. But for now, since the patch fixes
> reproducible soft lockup issue on single processor systems
> and taken ENOENT error meaning, let apply this fix.
> 
> Patch adds additional ENOENT check not only in rx kick routine, but
> also on other places where we check for ENODEV error.
> 
> Reported-by: Richard Genoud <richard.genoud@gmail.com>
> Debugged-by: Richard Genoud <richard.genoud@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>

Tested-by: Richard Genoud <richard.genoud@gmail.com>
(on 4.14-rc8)

This is working like a charm now !

Thanks !!

Richard.

> ---
>  drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
> index e2f4f5778267..086aad22743d 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
> @@ -57,7 +57,7 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev,
>  		if (status >= 0)
>  			return 0;
>  
> -		if (status == -ENODEV) {
> +		if (status == -ENODEV || status == -ENOENT) {
>  			/* Device has disappeared. */
>  			clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
>  			break;
> @@ -321,7 +321,7 @@ static bool rt2x00usb_kick_tx_entry(struct queue_entry *entry, void *data)
>  
>  	status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
>  	if (status) {
> -		if (status == -ENODEV)
> +		if (status == -ENODEV || status == -ENOENT)
>  			clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
>  		set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
>  		rt2x00lib_dmadone(entry);
> @@ -410,7 +410,7 @@ static bool rt2x00usb_kick_rx_entry(struct queue_entry *entry, void *data)
>  
>  	status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
>  	if (status) {
> -		if (status == -ENODEV)
> +		if (status == -ENODEV || status == -ENOENT)
>  			clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
>  		set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
>  		rt2x00lib_dmadone(entry);
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: rt2x00usb: mark device removed when get ENOENT usb error
  2017-11-09 10:59 [PATCH] rt2x00usb: mark device removed when get ENOENT usb error Stanislaw Gruszka
  2017-11-09 11:58 ` Richard Genoud
@ 2017-11-10  2:32 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2017-11-10  2:32 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: linux-wireless, Richard Genoud

Stanislaw Gruszka <sgruszka@redhat.com> wrote:

> ENOENT usb error mean "specified interface or endpoint does not exist or
> is not enabled". Mark device not present when we encounter this error
> similar like we do with ENODEV error.
> 
> Otherwise we can have infinite loop in rt2x00usb_work_rxdone(), because
> we remove and put again RX entries to the queue infinitely.
> 
> We can have similar situation when submit urb will fail all the time
> with other error, so we need consider to limit number of entries
> processed by rxdone work. But for now, since the patch fixes
> reproducible soft lockup issue on single processor systems
> and taken ENOENT error meaning, let apply this fix.
> 
> Patch adds additional ENOENT check not only in rx kick routine, but
> also on other places where we check for ENODEV error.
> 
> Reported-by: Richard Genoud <richard.genoud@gmail.com>
> Debugged-by: Richard Genoud <richard.genoud@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> Tested-by: Richard Genoud <richard.genoud@gmail.com>

Patch applied to wireless-drivers-next.git, thanks.

bfa62a52cad9 rt2x00usb: mark device removed when get ENOENT usb error

-- 
https://patchwork.kernel.org/patch/10050781/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-10  2:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-09 10:59 [PATCH] rt2x00usb: mark device removed when get ENOENT usb error Stanislaw Gruszka
2017-11-09 11:58 ` Richard Genoud
2017-11-10  2:32 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.