Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2531062imu; Thu, 29 Nov 2018 06:29:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/W9i0eZCNJB/SXQGqjaMAdqy9z1deksYmzjlV/4THf0bOp1JS7g1EvBh87IG/HU7V9vOU3c X-Received: by 2002:a62:1d4c:: with SMTP id d73mr1623949pfd.90.1543501755923; Thu, 29 Nov 2018 06:29:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543501755; cv=none; d=google.com; s=arc-20160816; b=ODK7NqA1Zf5KxaAvok4h+ml2w239eCyFFTjZF9naNju9ycEoPBoxXqYH+ILbIO4ckC 3vONaY0aVLA6rgZXlK9nK+KKfSy2cZCUhwdnSMa8+Tkd1sF4A5biJBxddIKeNxuWnSBk oepo3uuAc1TR1xqQVZN4ut0vVkaexkd8g6OTs5WiXGQmbnHlYda/LPSm9PmdgoGsND+s Gwz9GJeHXRDs3siVloAVvK3V7jeUhcMIwhhraGHfx4L25nxcx7iTSSixa2cAPKUJgWUx DNUdrd85JyL5ZOrfsrnF6IwPczIbTj/0dsgU0CAY48FPdqyrNnvGYgNLvzXRfwtFzWbI /mAg== 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=RzRq4fKDyhXFEhp9vOJYVzQ1YgFW0vaumUJHd8CFy5Q=; b=ENvZcmOyhN9Sfhh5fnpFE5XjkPICpXcC78HVX1X0ba1EhJ0P2uFcAWSwfdz5h02qdl 5+l9cW3x3592qBzJy5jeVX4PCJBonQzJUK2hDPFVJpFpeDCqBQiYQ2jy8EurzBCkIR6+ MpPlCQg9Mw44D4mrpE00h7JXk0km3Vrtkgw2NQ2o0MRpBfRWYIJ7dBjrOY8tRwjN055h YtxjCCqXAkQDuzF9XiNr5CQxLTPZOz3GbuqESgKG4z2de8oHhICTUzsd/7sXd4H5v5dR bJIpQ/15ngg1GPh7n8/TqtzHhKw1IztkwZOiWG1qYPVuYRFnXNNgwwlO/THZL7xx4bjr M7tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=u1maU05m; 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 d1si677087pla.412.2018.11.29.06.29.01; Thu, 29 Nov 2018 06:29:15 -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=u1maU05m; 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 S2388050AbeK3Bd4 (ORCPT + 99 others); Thu, 29 Nov 2018 20:33:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:34808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733011AbeK3Bdz (ORCPT ); Thu, 29 Nov 2018 20:33:55 -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 2CC9B2146F; Thu, 29 Nov 2018 14:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501702; bh=nu3g1+EI96gg0CYT+j1+IPNrrvwBbXDXivnPgFNjJlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u1maU05m2biHN4vxmSSSJ2/+Qhy1qU9qzcSRBQ0wxdRnzfDlFAIS71gZ3ln2SzTvT yjL1vorbxAySDH2PWkOdY+fJG0itM9Hb2NJiqDE2I7yVwAELXJ+hB2ZapuZ23cMgJ7 9E1JK2YuscuQudUpJKynMwt1zEqbhguz84YHdVUI= 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.14 091/100] usb: xhci: fix uninitialized completion when USB3 port got wrong status Date: Thu, 29 Nov 2018 15:13:01 +0100 Message-Id: <20181129140106.658352954@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140058.768942700@linuxfoundation.org> References: <20181129140058.768942700@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.14-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 @@ -895,7 +895,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 @@ -1746,7 +1746,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(portsc) && + if (!DEV_SUPERSPEED_ANY(portsc) && hcd->speed < HCD_USB3 && test_and_clear_bit(faked_port_index, &bus_state->rexit_ports)) { complete(&bus_state->rexit_done[faked_port_index]);