Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1029243ybl; Wed, 8 Jan 2020 09:46:20 -0800 (PST) X-Google-Smtp-Source: APXvYqyBV8Sx6Il7bGeUfXcRhVUZANWa8VwRV6MalAMXjYj6gk/uuHg55yXs2yAYRLRRVjeZ7kLo X-Received: by 2002:aca:de06:: with SMTP id v6mr3855636oig.168.1578505579985; Wed, 08 Jan 2020 09:46:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578505579; cv=none; d=google.com; s=arc-20160816; b=t82/MPD8/NypqLOhDg4UwS+EVgyVA0lqrv1a9jy65td2JU0UzWZIALmW7oqNFJGJ8w dEBYmv01ZApnrK+slQRO+JHB2MnwgJ03kahG7/Ru0/t65tWM2iSfCzcWJ6ZNQuPkMhXq FvstQVYEfpUhbl+AbzIQ/juXJ7armhZ2SU3E8tupDC12IkJVISeVf4c54vRB+5aK402w ihF+HuabK1+62j3/HXZTWYYbGKiFgQaJKY55p1OartgRQ+pHmEzGJbtUMgyM0wQ6Fvla qJEBZpbHJcR+yL+8JCiismMU3u1KREXoHdZINw2onV2JNEg02ODrECZcUC4knQA3Z/EV TKQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=TdYw3mtt+Ou4YvyJfL61dr+341ZD/5yjX6nCsANMnfw=; b=wnD7vaQgwAvUucTGeQM/YDUyrt2Dl6+kC2SduuqbJS6wJ25oNIlmKOyOE5ua5JoPWm xsC9AWDg4M1ZCDrS6s7UXLEx8/6Po+GKXMO2hRRO76qX6R6idwCqftaB5RI3HDhwBPJW Si2Jd6rBCS9UXDOYAS7/1yRaNVdG0uG8+we8COCWQvRcSlfwhM6J0zPvh7q7XSU426am /R5qCwe3oH7elk6vlYf8iZ5Uah/dqNMKPsKQOD2VKZzrLJ8TMc5rgz4TvOXZmNpjQ5cX U87W9ADvVMPpkSKgH41ziZEAeCK7evqWTK9qkMV3giIbVLJa4y9CQjN5f5kvvEgHYWKY yKLg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e24si1974908otl.62.2020.01.08.09.46.06; Wed, 08 Jan 2020 09:46:19 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729087AbgAHPyv (ORCPT + 99 others); Wed, 8 Jan 2020 10:54:51 -0500 Received: from mga03.intel.com ([134.134.136.65]:29686 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728499AbgAHPyv (ORCPT ); Wed, 8 Jan 2020 10:54:51 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2020 07:54:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,410,1571727600"; d="scan'208";a="303589888" Received: from mattu-haswell.fi.intel.com (HELO [10.237.72.170]) ([10.237.72.170]) by orsmga001.jf.intel.com with ESMTP; 08 Jan 2020 07:54:49 -0800 Subject: Re: [RFT PATCH] xhci: Fix memory leak when caching protocol extended capability PSI tables To: Greg KH Cc: pmenzel@molgen.mpg.de, mika.westerberg@linux.intel.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <572bea6f-06d4-938a-802e-93386acf59d9@linux.intel.com> <20200108151730.21022-1-mathias.nyman@linux.intel.com> <20200108154008.GA2448418@kroah.com> From: Mathias Nyman Message-ID: <9e91c6a7-94a5-6ed7-22c7-ebc956403e8f@linux.intel.com> Date: Wed, 8 Jan 2020 17:56:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200108154008.GA2448418@kroah.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8.1.2020 17.40, Greg KH wrote: > On Wed, Jan 08, 2020 at 05:17:30PM +0200, 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 port can in theory support different custom speeds. > > Is there a "max" number of port capabilities that can happen? Or this > this truely dynamic? Almost truly dynamic, each capability points to the next, last points to 0 But we can't have more "supported protocol capabilities" than xHC ports. (MaxPorts value in xHC HCSPARAMS1 register) > >> + for (i = 0; i < xhci->num_port_caps; i++) { >> + kfree(xhci->port_caps[i].psi); >> + xhci->port_caps[i].psi = NULL; >> + } > > Nit, no need to set to NULL here :) Thanks, will remove that -Mathias