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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4A3EE8FDCF for ; Wed, 4 Oct 2023 06:36:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241298AbjJDGhA (ORCPT ); Wed, 4 Oct 2023 02:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241415AbjJDGhA (ORCPT ); Wed, 4 Oct 2023 02:37:00 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77757BF; Tue, 3 Oct 2023 23:36:56 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9356EC433C8; Wed, 4 Oct 2023 06:36:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696401416; bh=pa7PlYE1f7PRJnLxkIzhxGZmwYROa1YY5M3fNWKm49w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oeDiCfkA6r/wSRXjjzfbJh5Nvt3ZVWZQVDAMOnPgQD2hIP8PL3m85ZEqpwwU6vXHV hppiah+BeLZB5G3+T3AF3O6oFt+SgrXxwOP4kQOq9bhL9zAvJAmTLnA4L/U/Ne8xo2 v4XjZyo75kC7/eKfaj2AjZZY88dg0mfvXIdl5Pcs= Date: Wed, 4 Oct 2023 08:36:52 +0200 From: Greg KH To: Woo-kwang Lee Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, sj1557.seo@samsung.com Subject: Re: [PATCH] usb: core: add bos NULL pointer checking condition Message-ID: <2023100439-king-salute-5cd5@gregkh> References: <20231004062642.16431-1-wookwang.lee@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231004062642.16431-1-wookwang.lee@samsung.com> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Wed, Oct 04, 2023 at 03:26:42PM +0900, Woo-kwang Lee wrote: > This issue occurs when connecting Galaxy S22 and abnormal SEC Dex Adapter. > When the abnormal adapter is connected, kernel panic always occurs after a > few seconds. > This occurs due to unable to get BOS descriptor, usb_release_bos_descriptor > set dev->bos = NULL. > > - usb_reset_and_verify_device > - hub_port_init > - usb_release_bos_descriptor > - dev->bos = NULL; > > hub_port_connect_change() calls portspeed(), and portspeed() calls hub_is_s > uperspeedplus(). > Finally, hub_is_superspeedplus() calls hdev->bos->ssp_cap. > It needs to check hdev->bos is NULL to prevent a kernel panic. > > usb 3-1: new SuperSpeed Gen 1 USB device number 16 using xhci-hcd-exynos > usb 3-1: unable to get BOS descriptor set > usb 3-1: Product: USB3.0 Hub > Unable to handle kernel NULL pointer dereference at virtual address 0000018 > > Call trace: > hub_port_connect_change+0x8c/0x538 > port_event+0x244/0x764 > hub_event+0x158/0x474 > process_one_work+0x204/0x550 > worker_thread+0x28c/0x580 > kthread+0x13c/0x178 > ret_from_fork+0x10/0x30 > > - hub_port_connect_change > - portspeed > - hub_is_superspeedplus > > Fixes: 0cdd49a1d1a4 ("usb: Support USB 3.1 extended port status request") > Signed-off-by: Woo-kwang Lee > --- > drivers/usb/core/hub.h | 2 ++ > 1 file changed, 2 insertions(+) Are you sure this isn't already fixed by commit f74a7afc224a ("usb: hub: Guard against accesses to uninitialized BOS descriptors") in linux-next? thanks, greg k-h