From mboxrd@z Thu Jan 1 00:00:00 1970 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 3746632D0D1 for ; Mon, 17 Nov 2025 12:37:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763383075; cv=none; b=Pb2k7ioMsjbzzQ0ioKuZvDmF4p+K6LX0ChbRxN/Yq+V4cykih23PT8mTHKsm3NGDzhLHf76ovvo16eBq3zRZ96SdZZtCscP7J5jq6NtAa62cEN1SrhxeZI3AC/CZhxr0rkT8BRcnf3E5KOXuPYQf+HgLnZJpBKOKa/uqH/u7pnc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763383075; c=relaxed/simple; bh=LmLq4CKC7fXPDcwM7AoU/cFpF/xg4tVfiecF6cEefqI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sW98XP3dR8esjB+1uKBHSGgZMByvWVWANv5bhWbaijBZ1FuEQkaDibcZdL+cheLe1pihQVuXZ56xJ7bDKmGig+dONnz6rYHh7AY6zG3/LbTXHosShTi48F4H2fFfNWyAKYKw4h+1PLdemdpvg+Xu1+yg6xO19PL4oEvhWtUG4Eg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wadvo0BD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wadvo0BD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F537C2BC9E; Mon, 17 Nov 2025 12:37:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1763383074; bh=LmLq4CKC7fXPDcwM7AoU/cFpF/xg4tVfiecF6cEefqI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wadvo0BDE7f1q4iMiOjHVCsY9i7Q8wPD/hTm+YGEgeCV/KclnTecPoGrYkJOMvIoh N44tGHe9yPr8TIrQt907uuqMX/Ag8ypdkLmOxl5dqEXPVczVKUdOzAST3PcXAZrpVP e+xpbP4aqGClb3YydtAUZuLFR8kt4yutkoLX2tns= Date: Mon, 17 Nov 2025 07:37:51 -0500 From: Greg KH To: Zhengqiao Xia Cc: rafael@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] device_core: check null pointer Message-ID: <2025111720-sensitize-schnapps-3189@gregkh> References: <20251114141821.416835-1-xiazhengqiao@huaqin.corp-partner.google.com> <2025111523-preface-scoreless-b478@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 Mon, Nov 17, 2025 at 10:55:05AM +0800, Zhengqiao Xia wrote: > Hi Greg, > > Based on my analysis, Please do not top-post :( > > usb_new_device -> device_add -> device_private_init > -> > bus_probe_device -> usb_generic_driver_probe -> > usb_set_configuration -> "add each interface" -> > device_add(&intf->dev); > > > --> if of_node status is disabled > -> of_device_is_available is false -> not running device_add -> Why is of_node related to USB interfaces? > interface dev->p is null > usbdev_ioctl -> proc_ioctl -> device_attach -> __device_attach -> > device_attach -> if (dev->p->dead) > > Since dev->p has not been created at this time, dev->p is NULL, So I > think we should add a check here. > > Here is my current analysis, but there may be some misunderstandings > or mistakes in it. Could you please help clarify my confusion? As this code is very old, USB was one of the first subsystems to get driver core support decades ago, what has changed recently to require this check? Have you seen crashes here? If so, what is the traceback for them and with what hardware/drivers? thanks, greg k-h