From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B2EF1F8664; Tue, 17 Dec 2024 17:11:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734455465; cv=none; b=F1T9KrmsKBY88zjiBsEAvnGXVADimS6vACLgkAPyj5gzWD9/9+pPHs9jHHvNXg0nPLGhAFX9mC0XBEcsSlOYpJXHL/8GkEnGqOPgmce6V0nx0uJGu3Jnnl4pfM7VJMqcbp10Li62FSQko3549aZX5Dbiq78bxZyl+NN8aFNSiq0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734455465; c=relaxed/simple; bh=5yW1egmc6D7rXaFcgZokCdQv5eixc1JgnO9bkD/mTP0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HW2Vw3pVuqCEUb0nCYv6Nd9J7lBII6/YktGD4Hw3XK0mdac4nDoQ0UWO0rafcZMvuWMB3Z/Okg/n3LiHs4MDq/BXykcklaWsL3Hi9T4lYJd0ZzgGnFTq9C52j3okYmgFpUGGs3ZaxnK13ZUCQmQojuhspU4IOJb4Q9PhjUl513Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QPdQLzFj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="QPdQLzFj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6AFEC4CEDD; Tue, 17 Dec 2024 17:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734455465; bh=5yW1egmc6D7rXaFcgZokCdQv5eixc1JgnO9bkD/mTP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QPdQLzFjIG2eEhZfp9ua7+f4gYWRZAAaW2aEBIXOEMWNg6F334CF3u3Ih/QmCWDkF Uo8zutTKTJ/IMMMWV1lt3WJ1c+APqLg3TpNxcCEkhX64cagRgdLdG9QZ+FeCT376XV rQmrKcfjFvrhaqnh8fHmC28hmO/X5uNjc07buwb4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Mark Tomlinson Subject: [PATCH 5.10 02/43] usb: host: max3421-hcd: Correctly abort a USB request. Date: Tue, 17 Dec 2024 18:06:53 +0100 Message-ID: <20241217170520.562435535@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241217170520.459491270@linuxfoundation.org> References: <20241217170520.459491270@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mark Tomlinson commit 0d2ada05227881f3d0722ca2364e3f7a860a301f upstream. If the current USB request was aborted, the spi thread would not respond to any further requests. This is because the "curr_urb" pointer would not become NULL, so no further requests would be taken off the queue. The solution here is to set the "urb_done" flag, as this will cause the correct handling of the URB. Also clear interrupts that should only be expected if an URB is in progress. Fixes: 2d53139f3162 ("Add support for using a MAX3421E chip as a host driver.") Cc: stable Signed-off-by: Mark Tomlinson Link: https://lore.kernel.org/r/20241124221430.1106080-1-mark.tomlinson@alliedtelesis.co.nz Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/max3421-hcd.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) --- a/drivers/usb/host/max3421-hcd.c +++ b/drivers/usb/host/max3421-hcd.c @@ -785,11 +785,17 @@ max3421_check_unlink(struct usb_hcd *hcd retval = 1; dev_dbg(&spi->dev, "%s: URB %p unlinked=%d", __func__, urb, urb->unlinked); - usb_hcd_unlink_urb_from_ep(hcd, urb); - spin_unlock_irqrestore(&max3421_hcd->lock, - flags); - usb_hcd_giveback_urb(hcd, urb, 0); - spin_lock_irqsave(&max3421_hcd->lock, flags); + if (urb == max3421_hcd->curr_urb) { + max3421_hcd->urb_done = 1; + max3421_hcd->hien &= ~(BIT(MAX3421_HI_HXFRDN_BIT) | + BIT(MAX3421_HI_RCVDAV_BIT)); + } else { + usb_hcd_unlink_urb_from_ep(hcd, urb); + spin_unlock_irqrestore(&max3421_hcd->lock, + flags); + usb_hcd_giveback_urb(hcd, urb, 0); + spin_lock_irqsave(&max3421_hcd->lock, flags); + } } } }