Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9938897ybi; Wed, 24 Jul 2019 12:41:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPEHxOY9guTpsm5FxD3ToogqtyWoiQ6OD78odznzMO0gvvE2ztIJtJnEu0XGHUvbWtyizx X-Received: by 2002:a17:90a:9dca:: with SMTP id x10mr89996724pjv.100.1563997279038; Wed, 24 Jul 2019 12:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563997279; cv=none; d=google.com; s=arc-20160816; b=iFLTFoLsDU4W11j7I6KM2FlUrwANJdqdTGJrrzGNlOopEX40ahMx0eSqo6ZqcpqnxQ kNwg0wDaYdwZg3g8LlnUI4O9jhE/zwiW8eMhNhPeOVXwtwvCmo4+v5U8APKoDJmRcL+x aHcVwaJeY3ZsEJLRfaFwqXont5GjQb7uFjty7Vz44ZDUIqOOk+rKcPY5tkHw06MaMMtU hqlaQYbu3RAK6D6PQxInLzm394OnsKztg/nNf9jw0efFEBGmDhfUDEY6k6nmayQiT3E4 j1U+H4M0b00o35ZlBgfuZBph6EC6BRgkKZ1ZkmBPuwHlklNoB/3ToRL0gzKOAcevKBQA SexQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dyjie2yi5OP2xCR/md+WaHmMt35nn8MdSYjNDY34JOE=; b=NJzkC2zCgxfMN9zFTLfgHjdIfb0JQV2ado3A+AeESFilkkeZsQ31CsKWNIPrDvLwq3 d02gMzKVrtSHrekX/qu9blH8GtJjRhzOS2Okop/K5tm8zenQ0Iragc/GSqg2d9p9J+u9 gUF+3b8sOfEeSAuqC6TmGIX1Zj+QWU9Tu4KCm2SdFv3HJi8hOphrql9aw6FkG7irH6Dz PnzBsLB3b33//uuLDxt7IRU2d2UkhxJFIMrQt1GFNc/M5rQ0bLyJ1C6puhDQZhe816hB f++HJAxscMaPXAgniF1ttgUM8Nw2cmq0qWxE+YhSNVC7zvss0lSXtu1vZmXIdinpEdyC RM8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FNrWeM5E; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m143si16056341pfd.224.2019.07.24.12.41.04; Wed, 24 Jul 2019 12:41:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FNrWeM5E; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389544AbfGXTjv (ORCPT + 99 others); Wed, 24 Jul 2019 15:39:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:40814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387968AbfGXTjp (ORCPT ); Wed, 24 Jul 2019 15:39:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2DCBD21873; Wed, 24 Jul 2019 19:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563997184; bh=7o9Xv4v/8OR4iBMokihUSGoUMDyYGMEQWGUjEZbY+mM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FNrWeM5EljRSuKjkz1X+ZtNXQsyXqSOYCOpf5/i7Rh+ptFlF/azK2F/6SqgRHFLlW IMDybr+b/+hmGg9Gt3EBJnwE6XHQdSS+H1jfiC+PfakF5TvBaDFpUkz+KaTGOzOVgQ RQaRKVV7KccH1qzYUnkIlp20OVBJoga0X8lIktME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Soeren Moch , Stanislaw Gruszka , Kalle Valo Subject: [PATCH 5.2 351/413] rt2x00usb: fix rx queue hang Date: Wed, 24 Jul 2019 21:20:42 +0200 Message-Id: <20190724191800.898100343@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Soeren Moch commit 41a531ffa4c5aeb062f892227c00fabb3b4a9c91 upstream. Since commit ed194d136769 ("usb: core: remove local_irq_save() around ->complete() handler") the handler rt2x00usb_interrupt_rxdone() is not running with interrupts disabled anymore. So this completion handler is not guaranteed to run completely before workqueue processing starts for the same queue entry. Be sure to set all other flags in the entry correctly before marking this entry ready for workqueue processing. This way we cannot miss error conditions that need to be signalled from the completion handler to the worker thread. Note that rt2x00usb_work_rxdone() processes all available entries, not only such for which queue_work() was called. This patch is similar to what commit df71c9cfceea ("rt2x00: fix order of entry flags modification") did for TX processing. This fixes a regression on a RT5370 based wifi stick in AP mode, which suddenly stopped data transmission after some period of heavy load. Also stopping the hanging hostapd resulted in the error message "ieee80211 phy0: rt2x00queue_flush_queue: Warning - Queue 14 failed to flush". Other operation modes are probably affected as well, this just was the used testcase. Fixes: ed194d136769 ("usb: core: remove local_irq_save() around ->complete() handler") Cc: stable@vger.kernel.org # 4.20+ Signed-off-by: Soeren Moch Acked-by: Stanislaw Gruszka Signed-off-by: Kalle Valo Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c @@ -372,15 +372,10 @@ static void rt2x00usb_interrupt_rxdone(s struct queue_entry *entry = (struct queue_entry *)urb->context; struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - if (!test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) + if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) return; /* - * Report the frame as DMA done - */ - rt2x00lib_dmadone(entry); - - /* * Check if the received data is simply too small * to be actually valid, or if the urb is signaling * a problem. @@ -389,6 +384,11 @@ static void rt2x00usb_interrupt_rxdone(s set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); /* + * Report the frame as DMA done + */ + rt2x00lib_dmadone(entry); + + /* * Schedule the delayed work for reading the RX status * from the device. */