From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 956F3C47404 for ; Fri, 4 Oct 2019 14:17:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C90F2133F for ; Fri, 4 Oct 2019 14:17:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388724AbfJDORy (ORCPT ); Fri, 4 Oct 2019 10:17:54 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:44804 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S2388625AbfJDORx (ORCPT ); Fri, 4 Oct 2019 10:17:53 -0400 Received: (qmail 2273 invoked by uid 2102); 4 Oct 2019 10:17:52 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 4 Oct 2019 10:17:52 -0400 Date: Fri, 4 Oct 2019 10:17:52 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: David Heinzelmann cc: linux-usb@vger.kernel.org Subject: Re: [PATCH] Check for changed device descriptors when a connection-change occurs before validating the connection. In-Reply-To: <20191004132341.GA22292@dhe-pc> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Fri, 4 Oct 2019, David Heinzelmann wrote: > Hi, > > thank you for the feedback! I hope this time everything is in order. > However, the correct error description is somewhat difficult for me. You should follow the advice I gave you last time: Explain what the problem is and how the patch fixes it. > Here is the third version: > > From 58634d035508b621025da1d866179b59ed0ae37a Mon Sep 17 00:00:00 2001 > From: David Heinzelmann > Date: Fri, 4 Oct 2019 12:28:36 +0200 > Subject: [PATCH v3] usb: hub: Check device descriptor before resusciation > > If a port connection-change occurs, the connection should not be > resusciated without a prior check if the port connection is enabled. > Signed-off-by: David Heinzelmann (Insert a blank line before the Signed-off-by:.) See, this doesn't say what the problem is. Someone reading your description won't know _why_ a check is needed. The problem shows up when a device goes through a firmware update. It will disconnect from the USB bus and reconnect, and if it is attached to an xHCI host controller then the controller hardware will automatically initialize the connection and enable the port. But hub_port_connect_change() assumes that if the port is enabled then nothing has changed; it doesn't check to see if the device's descriptors have been updated. As a result, the kernel's internal copy of the descriptors ends up being incorrect and the device doesn't work properly. The solution to the problem is for hub_port_connect_change() always to check whether the device's descriptors have changed before resuscitating an enabled port. Alan Stern