Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933336AbcCRONj (ORCPT ); Fri, 18 Mar 2016 10:13:39 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:58279 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S933055AbcCRONh (ORCPT ); Fri, 18 Mar 2016 10:13:37 -0400 Date: Fri, 18 Mar 2016 10:13:34 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Nicolai Stange cc: Greg Kroah-Hartman , Peter Chen , Philipp Zabel , Rob Herring , Arnd Bergmann , Geliang Tang , Stefan Koch , Viresh Kumar , Tomeu Vizoso , Oliver Neukum , , Subject: Re: [PATCH v2] usb/core: usb_alloc_dev(): fix setting of ->portnum In-Reply-To: <1458255182-16217-1-git-send-email-nicstange@gmail.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1048 Lines: 36 On Thu, 17 Mar 2016, Nicolai Stange wrote: > With commit 69bec7259853 ("USB: core: let USB device know device node"), > the port1 argument of usb_alloc_dev() gets overwritten as follows: > > ... usb_alloc_dev(..., unsigned port1) > { > ... > if (!parent->parent) { > port1 = usb_hcd_find_raw_port_number(..., port1); > } > ... > } > > Later on, this now overwritten port1 gets assigned to ->portnum: > > dev->portnum = port1; > > However, since xhci_find_raw_port_number() isn't idempotent, the > aforementioned commit causes a number of KASAN splats like the following: ... > Fix this by not overwriting the port1 argument in usb_alloc_dev(), but > storing the raw port number as required by OF in an additional variable, > raw_port. > > Fixes: 69bec7259853 ("USB: core: let USB device know device node") > Signed-off-by: Nicolai Stange > --- > Applicable to linux-next-20160317 > > Changes to v1: > - Initialize raw_port with port1 Acked-by: Alan Stern