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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AEB9C352A4 for ; Wed, 12 Feb 2020 17:51:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 35A582168B for ; Wed, 12 Feb 2020 17:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581529915; bh=CxkrovGv+VwPpjoOAvZm2PqQCvnr5Wtoftc21B0UHTk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=dYpHNoePIL2kw7SJGYLqPoVxWT+e0B5HObM8htPcsbnlgsLN4zeN1hTwA4Z1SjwJN aj2FQ05cyMz9YkaANj6oflKWIrKgdWTxP3QFig7bB26ukn3yONm1V5hwQ0F2TMOEth 7fkC4dVcCaSznTFb5xIO3P7Rf22Q0bAO1oYH8fr8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728742AbgBLRvy (ORCPT ); Wed, 12 Feb 2020 12:51:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:43212 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727279AbgBLRvy (ORCPT ); Wed, 12 Feb 2020 12:51:54 -0500 Received: from localhost (unknown [104.132.1.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4A0CA20714; Wed, 12 Feb 2020 17:51:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581529912; bh=CxkrovGv+VwPpjoOAvZm2PqQCvnr5Wtoftc21B0UHTk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fGVjNz4UWtFx6kGkl2XTfCOEiXyadq7bMWbG9TozLizytoCWomtQAEQscEVeIMQMw MGcQLCU/Dvfia1A7iBwQv7rqwg69C4diPpEAHbFLQnkAL0RBpxCTfthen+NscnNRZy 2xNscEhefreq/0xFrJqZPllN3C/gI7Qx7PBjzY1c= Date: Wed, 12 Feb 2020 09:51:51 -0800 From: Greg KH To: Mathias Nyman Cc: Marek Szyprowski , pmenzel@molgen.mpg.de, mika.westerberg@linux.intel.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, krzk@kernel.org, stable Subject: Re: [RFT PATCH v2] xhci: Fix memory leak when caching protocol extended capability PSI tables Message-ID: <20200212175151.GA1872825@kroah.com> References: <20d0559f-8d0f-42f5-5ebf-7f658a172161@linux.intel.com> <20200211150158.14475-1-mathias.nyman@linux.intel.com> <20200211161316.GA1914687@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 12, 2020 at 11:01:52AM +0200, Mathias Nyman wrote: > On 11.2.2020 18.13, Greg KH wrote: > > On Tue, Feb 11, 2020 at 04:12:40PM +0100, Marek Szyprowski wrote: > >> Hi Mathias, > >> > >> On 11.02.2020 16:01, Mathias Nyman wrote: > >>> xhci driver assumed that xHC controllers have at most one custom > >>> supported speed table (PSI) for all usb 3.x ports. > >>> Memory was allocated for one PSI table under the xhci hub structure. > >>> > >>> Turns out this is not the case, some controllers have a separate > >>> "supported protocol capability" entry with a PSI table for each port. > >>> This means each usb3 roothub port can in theory support different custom > >>> speeds. > >>> > >>> To solve this, cache all supported protocol capabilities with their PSI > >>> tables in an array, and add pointers to the xhci port structure so that > >>> every port points to its capability entry in the array. > >>> > >>> When creating the SuperSpeedPlus USB Device Capability BOS descriptor > >>> for the xhci USB 3.1 roothub we for now will use only data from the > >>> first USB 3.1 capable protocol capability entry in the array. > >>> This could be improved later, this patch focuses resolving > >>> the memory leak. > >>> > >>> Reported-by: Paul Menzel > >>> Reported-by: Sajja Venkateswara Rao > >>> Fixes: 47189098f8be ("xhci: parse xhci protocol speed ID list for usb 3.1 usage") > >>> Cc: stable # v4.4+ > >>> Signed-off-by: Mathias Nyman > >> > >> Tested-by: Marek Szyprowski > > > > Nice! > > > > Should I revert the first and then apply this? > > > > Yes, please Now done, thanks. greg k-h