Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2524044imu; Thu, 29 Nov 2018 06:23:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/VFfetlysuqftq2jVVSBid/qxeaelSFKzHwhgRv9xR8XSWFAx3VS+BHnOU9BYTpwbVSzYZU X-Received: by 2002:a63:f811:: with SMTP id n17mr1452421pgh.23.1543501411294; Thu, 29 Nov 2018 06:23:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543501411; cv=none; d=google.com; s=arc-20160816; b=X588b6dffWw5iGzQ6Bl1wyYDgtwsg/v2JrgVMxW3cF2D9BdrN29mu1fSDMoKbFOSFD s26f5JXcqD0b8GJyVt7unHFozmhVul1+11t2g4bo8afCmAtrGKWx8mnRPEmIuIjAJ1IP IATnBnzLtwwNZw5g2XjnZ+w2Plpa+W6UdHIKNg5+142wkBFIGEEqV9sYkIW1v3FRLKn9 onH31OMrOrRpRhdYWqPIpAOGSYF+2BH5+JecWsuGDc0naUKaOYvrWBSfis4nfSgohBlr hzcEsHm0u+9XDhdSZTKBPZ8Lco5wXmtAu9uWl/Z7egFGUKFSXkM83CjexXS4XQw4ZUPu 2l6g== 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=Tw8traP/5C6EKIP3P6na093GcoTiJhKsdo8724mlDK0=; b=YAQF0I91SoGlKTa2Fs9WDJhuo93WhwfxvEx8KKn5AYTqJxvdEJI/ifchEhffLndBU3 hB2f3yexRffOI9wyEDW9BgX3hlw3L1tOYK1lTHebx98kGSnTzKiWprYLMv5OfI2BYxXU QfsLrtWge0LTxP3WOWt79fqFGcuNcCn+L6PboshAM6kfdptFTmIryR+ym/cewPobceiS LSL8soasv2xZYXzf1KQW8/7LX0rpPWFNHoyu72wuJnp1coPxLwXlyn2b0ik/9reksUby VCIMpcXjSQZaIeoFzsUBk8WMQn+h+EaBA4TjX7IhQGIAi5GUiC/XV6VrUJNEeDFRWYGo kMPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=w3k1NvNs; 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 w32si2095726pga.337.2018.11.29.06.23.15; Thu, 29 Nov 2018 06:23:31 -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=w3k1NvNs; 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 S1731385AbeK3B0G (ORCPT + 99 others); Thu, 29 Nov 2018 20:26:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:49714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731378AbeK3B0D (ORCPT ); Thu, 29 Nov 2018 20:26:03 -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 5FFCF20868; Thu, 29 Nov 2018 14:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501232; bh=kc74CKBbj0W3GslJ/r76qP1IZXndZ4vXvhaK0hp1A14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w3k1NvNsNREiQAukeTtP3d0Bz2yU3grIv5EpZ7iAaqCu33cGWur0vWUvvq2a8+Fr3 5Z3zRc91hram+Jq2Ye9W0E6prfn6o5hUPmnE12tGIUEEhjA3Zk9sfgyJ02Ije64aN1 TBdKuSErEfd1XfXjFBppcUWFZdjENmt9R1HBY2uc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaron Ma , Mathias Nyman Subject: [PATCH 4.4 81/86] usb: xhci: fix uninitialized completion when USB3 port got wrong status Date: Thu, 29 Nov 2018 15:12:46 +0100 Message-Id: <20181129140116.249572061@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140109.832117862@linuxfoundation.org> References: <20181129140109.832117862@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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aaron Ma commit 958c0bd86075d4ef1c936998deefe1947e539240 upstream. Realtek USB3.0 Card Reader [0bda:0328] reports wrong port status on Cannon lake PCH USB3.1 xHCI [8086:a36d] after resume from S3, after clear port reset it works fine. Since this device is registered on USB3 roothub at boot, when port status reports not superspeed, xhci_get_port_status will call an uninitialized completion in bus_state[0]. Kernel will hang because of NULL pointer. Restrict the USB2 resume status check in USB2 roothub to fix hang issue. Cc: stable@vger.kernel.org Signed-off-by: Aaron Ma Signed-off-by: Mathias Nyman Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-hub.c | 2 +- drivers/usb/host/xhci-ring.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -744,7 +744,7 @@ static u32 xhci_get_port_status(struct u status |= USB_PORT_STAT_SUSPEND; } if ((raw_port_status & PORT_PLS_MASK) == XDEV_RESUME && - !DEV_SUPERSPEED_ANY(raw_port_status)) { + !DEV_SUPERSPEED_ANY(raw_port_status) && hcd->speed < HCD_USB3) { if ((raw_port_status & PORT_RESET) || !(raw_port_status & PORT_PE)) return 0xffffffff; --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1673,7 +1673,7 @@ static void handle_port_status(struct xh * RExit to a disconnect state). If so, let the the driver know it's * out of the RExit state. */ - if (!DEV_SUPERSPEED_ANY(temp) && + if (!DEV_SUPERSPEED_ANY(temp) && hcd->speed < HCD_USB3 && test_and_clear_bit(faked_port_index, &bus_state->rexit_ports)) { complete(&bus_state->rexit_done[faked_port_index]);