From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753059AbcHOSlK (ORCPT ); Mon, 15 Aug 2016 14:41:10 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34706 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752713AbcHOSlI (ORCPT ); Mon, 15 Aug 2016 14:41:08 -0400 Date: Mon, 15 Aug 2016 20:41:17 +0200 From: Greg KH To: Vaibhav Hiremath Cc: linux-usb@vger.kernel.org, robh@kernel.org, p.zabel@pengutronix.de, stern@rowland.harvard.edu, arnd@arndb.de, peter.chen@freescale.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] USB: core: of: Check device_node before parsing in usb_of_get_child_node() Message-ID: <20160815184117.GA883@kroah.com> References: <1471285870-21433-1-git-send-email-vaibhav.hiremath@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1471285870-21433-1-git-send-email-vaibhav.hiremath@linaro.org> User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 15, 2016 at 11:31:10AM -0700, Vaibhav Hiremath wrote: > In case of HUB devices connected to USB ports, we may not have DT > node representing it inside USB, and when devices connected to hub > gets enumerated, call to usb_of_get_child_node() leads to NULL pointer > dereference. Really? That seems messed up. > In the usecase we have, where EHCI port is connected to USB HUB > device, and downward ports of HUB are connected to further USB > devices. When those devices gets enumerated, in order, > 1. USB HUB -> > -> Call to usb_of_get_child_node() is OK, as > parent->dev.of_node is pointing to host node. > 2. Devices connected to downward port of USB HUB > -> Call to usb_of_get_child_node() leads to NULL > pointer dereference as parent->dev.of_node = NULL, > as USB HUB DTS node may be empty. Why is the hub DTS empty? Shouldn't that be the fix here? thanks, greg k-h