Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2531223imu; Thu, 29 Nov 2018 06:29:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/VNxkUB1FQWiiVaUhcK4DzrJiswr/6sI1pEHRxonAnck8acUHhqPihnvak8+aKmNW+r6L1V X-Received: by 2002:a63:78cd:: with SMTP id t196mr1453061pgc.62.1543501763400; Thu, 29 Nov 2018 06:29:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543501763; cv=none; d=google.com; s=arc-20160816; b=W5srPxtv4F2D1XAFF2a1TYGUl3UqZC1W52fJ8J4mu7XHKZv+eVcoV79QkwtjQiuv56 SEegu50QDVQPBdWEb4Y8LnjhGmkmxdjghsHQTFaDmt6rS/Q8iZsXOwlz9XAmBRXiQZGE kIy3bb3K8KVc1DhsKqMKCgdgEb2MqkDPwUjkfoyCscVOiHCGMvfGmW5OXvvqmlt/fN/B k8hJe8IzDbn00/WxIoxYbRB747ArnHiUs+CpYHTVFaTqOI+WxA3UQt3MypHJsPIAO8P7 GU3s5eSNQQ3qpqoHrUcwuT/XlfDtqGo97+1vwsVfaDQypkQ8GsLrAXNZK3V5ICQlyD5w 01nQ== 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=mS3SSlemgIu2BpPOebaDqB0ylzXtgrf217Q7a9KDKl0=; b=fQe3Wqk2ho72zW/vcbub0NCIBDKqxcld9VuW+uVqXjsbajzbk5RFBSDdbbbU+POETd XddRpoGHf7g2Jx8vkS42MSgRs9ASI+JOZH4zEc0WGtsgynF9s1Kr4GCPeabmt9maLTuB xvVCsROFzEJJB8PurCRbIftMU1JxRVwmrIjfBDIqTAg7k6IHQWy0vX94RJEYnZl/949/ erMI5PDY4M9RgH1pvzDql2ay+VJ6+KvE2StPqQSigWn6+gtQ+ZoPX0wvIjGjN/0C4Adj b37/FRVVG84WpKiMWeSNo+5NvsbLYFKYmhftFMyOYrecH73kD1vJaUp1HEis2ucolEU1 PgeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ys1U5qjS; 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 p5si2223802pls.338.2018.11.29.06.29.08; Thu, 29 Nov 2018 06:29:23 -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=Ys1U5qjS; 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 S2388118AbeK3BeI (ORCPT + 99 others); Thu, 29 Nov 2018 20:34:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:35140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731958AbeK3BeH (ORCPT ); Thu, 29 Nov 2018 20:34:07 -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 1CCD021479; Thu, 29 Nov 2018 14:28:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501714; bh=+S7wsRgb91DyrrJi3Q/BL7r/ZfcIEWV1aqFTTyLkUoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ys1U5qjSY240rOiD9xeH+GcqNL6FiJEFk2XcwRCNxL4jDjJPxgCilLyaKtXppEMir VccadBJWIkkVY6oKmQkubTp6XODwdUOXo3HYFKuFsbbRxrQQ50rA292QHpVRB0P9Fk 2GGOJ4FSHhL46d+y+MzP5aHVY9Yx1IWtpWIY/4Us= 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.19 011/110] usb: xhci: fix uninitialized completion when USB3 port got wrong status Date: Thu, 29 Nov 2018 15:11:42 +0100 Message-Id: <20181129135921.699733671@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: 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 @@ -876,7 +876,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 @@ -1642,7 +1642,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(hcd_portnum, &bus_state->rexit_ports)) { complete(&bus_state->rexit_done[hcd_portnum]);