Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2533778imu; Thu, 29 Nov 2018 06:31:21 -0800 (PST) X-Google-Smtp-Source: AFSGD/XeNMJB/t5YTfrN+3dsf5VMluYYQOvEkZu2Jl7g7Elxb2uQe9crJn4lu5COCNhuAb2+KPG2 X-Received: by 2002:a17:902:5066:: with SMTP id f35mr1729693plh.78.1543501881094; Thu, 29 Nov 2018 06:31:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543501881; cv=none; d=google.com; s=arc-20160816; b=tdocEa+RBtCYhRCEps6DGG51ogbc/idEmSq88rfm9f9Q5C6n64IRZA0K2uCr/rojil 7DifT0Jj0slr4IXW/XCEa1Pxl3SQzb5VNDPNGa5/FjQ/AIijwGwmmm4ZvJVvUxrNt968 YBjvwkQMMfT/RPga1Q8QpRlJkbErjx4Lf6KUJdr+mxqK6y42Y9+aaVwy/rKKpdt5KGIH ZSD/qHSCo8vNljF+EL+II9lTvZFVuuDmcR/KYTrUJY9uY5cgqY+X8ExITP/txLRf0ulE XQuMlQqmGMR75QcQmrV8kZYCSkTbD/mcL/qa5smUSWbIBZuEeYMWh4oXYa+s9GjXgm4p rnvA== 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=7FUc92c0kFy0bXy4ufEAmuYQGcsk0Lrw49I5lXD3PhM=; b=ilXj2sOdmWyV7+/S60GADmW5vmNHmfevLBtGCmkqUq3mGgqPA+a+4+2bmL73o7NTPa v2MIccuNVDP4v/y/0rpuf3x0kQl0a3fTNrTUMNGlA1Rwk5OTZnQ/dG8mdMXpUPsSQOPb Qwjt6OLHkwBtR9btILS4rl/teThADeuaD0oLeAqQVq/4NSgywaL9MvHnu/KVlwP5SRig L0CXWHacNPXkOGMdrCwYoNt3CmdnYePzHpQXXPZyvpiPKjR6GsrATFIcTnfoUhpEdrSo /iNcIJS5CCuwS1jSZixjZqGoFI4uNj5tJszbCKHwozuljLIc+jspygx34XFApfqFwmT1 Zwfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HLu8Zg96; 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 i20si2211955pgh.187.2018.11.29.06.31.06; Thu, 29 Nov 2018 06:31:21 -0800 (PST) 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=HLu8Zg96; 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 S2388314AbeK3Bej (ORCPT + 99 others); Thu, 29 Nov 2018 20:34:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:35982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731995AbeK3Bei (ORCPT ); Thu, 29 Nov 2018 20:34:38 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 5D628213A2; Thu, 29 Nov 2018 14:29:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501745; bh=iy/l3XAxRAjsruUfjy/yeQD7+NMW/Ox5IXayp7KMVjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HLu8Zg969v+ttuiugmviJh6VvccaASb8noPDo3qyYwqG7zb124lxXiyE9OeJ2S7WD I46CaHNR4MllLh0T1A6c2D6ZHBsCTwwodi9G7emZDLBxD0BbANr1Qhy7qdchA02tb9 JmDmxTqaHo3dEQKQFuOANfh+sbnUPa8SHyRdmgyo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Chen , Jack Pham , Mathias Nyman Subject: [PATCH 4.19 009/110] xhci: handle port status events for removed USB3 hcd Date: Thu, 29 Nov 2018 15:11:40 +0100 Message-Id: <20181129135921.619729335@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129135921.231283053@linuxfoundation.org> References: <20181129135921.231283053@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mathias Nyman commit 1245374e9b8340fc255fd51b2015173a83050d03 upstream. At xhci removal the USB3 hcd (shared_hcd) is removed before the primary USB2 hcd. Interrupts for port status changes may still occur for USB3 ports after the shared_hcd is freed, causing NULL pointer dereference. Check if xhci->shared_hcd is still valid before handing USB3 port events Cc: Reported-by: Peter Chen Tested-by: Jack Pham Signed-off-by: Mathias Nyman Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-ring.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1552,6 +1552,13 @@ static void handle_port_status(struct xh goto cleanup; } + /* We might get interrupts after shared_hcd is removed */ + if (port->rhub == &xhci->usb3_rhub && xhci->shared_hcd == NULL) { + xhci_dbg(xhci, "ignore port event for removed USB3 hcd\n"); + bogus_port_status = true; + goto cleanup; + } + hcd = port->rhub->hcd; bus_state = &xhci->bus_state[hcd_index(hcd)]; hcd_portnum = port->hcd_portnum;