Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5105621ybv; Tue, 11 Feb 2020 09:15:01 -0800 (PST) X-Google-Smtp-Source: APXvYqyu9HfgAMZzI62LBRYy55Xl9bCY8W8JTNvat+fAbc9W2+9ROf58DpwWRrDuFLPaz5TGVMXS X-Received: by 2002:aca:55cc:: with SMTP id j195mr3623510oib.22.1581441301713; Tue, 11 Feb 2020 09:15:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581441301; cv=none; d=google.com; s=arc-20160816; b=sE4OpcGnk1esEoYHedjQvTOaaGLqvFtQsTfn8jtZwSGWE93/reMr7NQoM3pqaYDpVF Sa2sNUep2Lk9PAYjcTSmIGejhw7smCZ6dNj3sCui51xnG+yF+Uo2hfEsJElu6ANC/spZ oqYlZefic4hQSpX/b1dCCRtJH4POCJWoJDJv2UQuUty7+2dkzrPVNmRnRlyahVQHIkvc /kSBSYkD6XLglfoc+XoKv8jW7ckQOXOnu1xKfB0RuEVfbSjyg/x1sBqfKnflrr727PQ9 3SZ2u5UfnUCLeSf5U5BMyXqnoF4xAmJ7cFI+TA1F0EctAfdDAxzTdM/zQ0B7ps/hn/RZ V1Zw== 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=SW+4QNlO/7QBwqb8VO5zHRgHJ+lSXgPvQ1z6oWa90jw=; b=Lrid3IAwZCmdt/3gSCdAn+zi19/+Q7TUmh6RtwXAoqp1ghW4CNcO4XmBFYBnHj/MtC ALNJlUgcEirLP3T0MfoOTqWtgvaxqBz7YOrCr57cR2768siEdo8X81PqkgolsMiV4FBS CrVq+GHBQshp2NdazyEqPJslLGRnRjGFDZEzOcJXkG66Uca+AMM2QDb3YmwHtKX7XgJA mZ+qIK4UTQqxi7rTf0UPYERnzqNhH1ZgwRMDJ5OH7C2JE34IU7YW/F8YCQK2L7zRr7II +QlGtLFQN8PszFH0gOkSmOgqkce5GmgsrGqR5OYp3/6ywxl7RhHermvmwA4kZhxqoGGL tfkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jWiiqI+7; 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 d197si1896789oig.115.2020.02.11.09.14.48; Tue, 11 Feb 2020 09:15:01 -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=jWiiqI+7; 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 S1730514AbgBKQNS (ORCPT + 99 others); Tue, 11 Feb 2020 11:13:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:50338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729390AbgBKQNS (ORCPT ); Tue, 11 Feb 2020 11:13:18 -0500 Received: from localhost (unknown [104.133.9.100]) (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 6BE232070A; Tue, 11 Feb 2020 16:13:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581437597; bh=mpthMPkNTmBrSE6fyhf8FwsYXxQ+Fb0JRMAAkISpmgU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jWiiqI+7RyyCw3hJoQhHNZTg2/M9zQnl8+zLXrDAe1n2XkHIKE5YO/a8mQGkpMhu5 KCScjHxyJHCCgMF0uw8fDyTmr9OOpQtdCrbZx5GL2ySWQun19bECNPXzreriYToGS2 zqVoav8R35mGJ7cw9diNyL4HDwYgvZITLVdbLaco= Date: Tue, 11 Feb 2020 08:13:16 -0800 From: Greg KH To: Marek Szyprowski Cc: Mathias Nyman , 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: <20200211161316.GA1914687@kroah.com> References: <20d0559f-8d0f-42f5-5ebf-7f658a172161@linux.intel.com> <20200211150158.14475-1-mathias.nyman@linux.intel.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 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? thanks, greg k-h