Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7701168rdb; Thu, 4 Jan 2024 05:14:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYvrMLXDhzrPGBfIZgbRG8L+Uy8shLm1FqdqKvN7+koiHb5Suo2GDnrvQHClVH2mHFhbQL X-Received: by 2002:a05:6512:2829:b0:50e:af7c:85e9 with SMTP id cf41-20020a056512282900b0050eaf7c85e9mr150416lfb.89.1704374051746; Thu, 04 Jan 2024 05:14:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704374051; cv=none; d=google.com; s=arc-20160816; b=UY2yTlg0YiOKmYYswOo0dv3V9YNorBGmLiUFPQhDfewLkRtCN+Gwri6lsXLyL4JRLc RawMqjBW29UvMIKjwpzA5J/qb6TbLe0WBkE7vrLOd7GE4sAosrVsZkzPKVXzvNmQGHkz p6A7Yh2eP/L3KXNQgh2JAdS26YzJhD6lrA/xEhqHQraUZE4od3Mr/25glWMl/9T6jxyl jrFmpgDhrSZLm3X1U8HfK45ZN9ZA4legW8VOAZUSLrxvBWaaGf/ipcCVW3I0PuWHe3Vp pujMlirE3M4z+ZlLhfgEB1AJFZHDAQcWaWOmAGYR/45HcPr/HBMdaTS7khSS+LOrjKbK 60UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dQ+eztloJ5r69IbPh5fbkkPPlI8NsNZe0/T4RUUv67E=; fh=121LUqpsVikNmc941RLF3l+EyrTvVq61IJ1+GqRVeB4=; b=QCR6QVwQU7pyOt3vAcnexANjvLo5S107b17Eo7r55TMpa68jorJY2WQS472vrnf9cj 4tyR5/lo4J3Qje3TZ85okosQ2Bm409AHS/XgX6GlwUl1bn/DarqHNffKUUqTytvt9/kT U1PXSzT9tzcfnsi0I9wZeKuXBeRxz/4nVcF4NRsBC3syyzh5elOGw+91gqHCteunfwpc ONS1c9HtM1cbZSaZHFLXvO7/AzJRd6FfXNUszhjTowLqh3TbRVka4z/Pm7UaSiMQ6ztV jfKKQGK8TEOb3LwZ3JbWWjalBOujar+5WoKdyeMbRUPWRIY2axfmefdINcwEMtdX68of omjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rog4gwco; spf=pass (google.com: domain of linux-kernel+bounces-16693-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16693-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id di19-20020a056402319300b0055340e62760si13370516edb.505.2024.01.04.05.14.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 05:14:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16693-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rog4gwco; spf=pass (google.com: domain of linux-kernel+bounces-16693-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16693-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 78A5E1F22993 for ; Thu, 4 Jan 2024 13:14:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 113362233A; Thu, 4 Jan 2024 13:13:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="rog4gwco" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DE9B22313; Thu, 4 Jan 2024 13:13:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60AE0C433C7; Thu, 4 Jan 2024 13:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1704374033; bh=VOJ4TOzf0UAb3CYkaYfqXUT1K2mGh/tBfWX8UVL7014=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rog4gwcoFq0XA6IYXBXaYoPu2pPOYcPp3VUinYVysvX7iIFecNlid2YnKuCtQ88+u z01tEqmI8tac+nIB8SaJN9+J6EwRr7GRqS5T6G63WXipfJ+M+gX2H9b7QtFLwWWqZB d0QWeQW/tlMQiz5Gaqdg/Xy8p2YoTJbsMEm/W3NQ= Date: Thu, 4 Jan 2024 14:13:51 +0100 From: Greg Kroah-Hartman To: Udipto Goswami Cc: Alan Stern , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: core: Prevent null pointer dereference in update_port_device_state Message-ID: <2024010432-fifth-shakable-0d84@gregkh> References: <20240104102616.20120-1-quic_ugoswami@quicinc.com> <2024010447-sprite-shelter-0743@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Jan 04, 2024 at 06:35:38PM +0530, Udipto Goswami wrote: > Hi Greg, > > On 1/4/2024 4:14 PM, Greg Kroah-Hartman wrote: > > On Thu, Jan 04, 2024 at 03:56:16PM +0530, Udipto Goswami wrote: > > > Currently,the function update_port_device_state gets the usb_hub from > > > udev->parent by calling usb_hub_to_struct_hub. > > > However, in case the actconfig or the maxchild is 0, the usb_hub would > > > be NULL and upon further accessing to get port_dev would result in null > > > pointer dereference. > > > > Is this true for any real (or fake) hardware? > > We saw this in our QCOM hardwares where lvstest.c was calling > get_dev_desc_store: > > usb_set_device_state+0x128/0x17c > create_lvs_device+0x60/0xf8 [lvstest] > get_dev_desc_store+0x94/0x18c [lvstest] > dev_attr_store+0x30/0x48 > > I think the part of the test procedure is to first unbind the hub driver > which calls hub_disconnect setting the maxchild = 0. Are you sure lvstest is correct here? thanks, greg k-h