Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6315754ybv; Wed, 12 Feb 2020 09:52:22 -0800 (PST) X-Google-Smtp-Source: APXvYqyPSkwgvTtMFOzRk8Md4XQJePU4uHTCql59FxFEcZBE7CtrkeargzKOeCatIY6iWrC0n6lw X-Received: by 2002:aca:55cc:: with SMTP id j195mr197858oib.22.1581529942402; Wed, 12 Feb 2020 09:52:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581529942; cv=none; d=google.com; s=arc-20160816; b=rr1jlBWNcSapKMLR3kxD4Cf8cedqyas82/yBQSqg5iBdCYnst0Jc1AVsl/HETIf6YY qBjl6cBXEweXjmlyaaBptZxXMnnl9AV3Sp+5bBYPbwlSSxDUVUe7D3NBKOTzR2ilJBqJ 3g3LdfmtK8QTDD/SSXf6Im6A1kmNQtwCznBE7XGEGu31MhMFGdlNvW8lKRzndFcSp3DS NNAw/xik4svKdLOuzHAAwbywuUbLEmYVDx08+GOeIriDyhyriatRB9s34PL9sAgSP890 5dIoUqVhVqxx16Y/O29sD/8bMhs+15h+f6NJ74Gcr0eyMi0eI9rcgNnNL7CfPZafVsZt 9tig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=S+Sz20YbMtXAVrTkUcJGmXmotww6yQmM4JsfgVaTxJI=; b=okR20a6Sh/ZcKzkve7r+n7RRjTs/r2khBivWuZitxiv3Lpchv8Z2Lm4nZbNLb1Rfvh 6/ukIDjhK99S4oUYYTj53DcxVZMUSh589XhBTrL+ByF8bapjmBRyf1wmjaPGHLH4CHD2 n/rxI9pqjSN+xVtjydud5kVSl98Y9klYqXnLQww5ojN4KP46SkIpMWPYJkuBOdnRWbmB jjIm0rBItkmXqO5qEy0sIpQBYXQ7xPZUdUAN9BRsdJy3f4vvBIU9bH41DNyAJ2wHOeez FroN9bxLPslidEdf9nTWDsKhEYcZXpnZN3wsd3ATKj6CBcoRGLFtz0ch9w8tmc1wTXb5 6rmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fGVjNz4U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c130si3337553oib.182.2020.02.12.09.52.08; Wed, 12 Feb 2020 09:52:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fGVjNz4U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728595AbgBLRvy (ORCPT + 99 others); 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