Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1025713ybl; Wed, 8 Jan 2020 09:42:39 -0800 (PST) X-Google-Smtp-Source: APXvYqymrwZth9yZKkXi4PvV4ukWC/u5lccfSmIsI0VDAKF4zdtzH+esb5KPXe/wGNFSuAftJJ/k X-Received: by 2002:a05:6830:4a7:: with SMTP id l7mr4827179otd.372.1578505358973; Wed, 08 Jan 2020 09:42:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578505358; cv=none; d=google.com; s=arc-20160816; b=KNay6menPvwKo+milzrmV1xxkrutPP/reC5AUTkhceShC1RUodfKK3TDBJWkQoBKqe hKL06DodHxWho1r5PMT6bTqBewt5PHO1VgGSJXJyN0inHD7W5ngv1EGWN+DiFNcQKvFp rq0tR4iJkFxuLGT97UNMyorSGbND0Tc/0yFN+ow0xCjFYlUccrzgR6x6ypwULEsLRhUj LYvtc+Iu30IRMALj49M9JemH64TyDH/8opi3kxkomOaYNLjxPVzh9h4SM2derVgL2ytR 6aFaDdgOG8q0mJTb6itjH4eknBP6rAZsmi8BjEixBJult+WPFN7nlv2AUTZF+MaA/XGU ER7g== 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=Pq0Y6UZbIRoLQFi9TzGTa2xLA+YbDzlSENHx+F/CdVA=; b=IO8U4Sw4lNNAAmqd0B3pmU7tFBns8b2REZnzMIXpGcY0IFoKr29GTy5kaohNx8dP57 2nJ2MGAJNg1okG2GH6MCBymNZCE0ncqrDSTWcttjBITmGXnzSPbpF0tmPipLT4KANQRR hbpU9P0fJtUMw/pkoqV1irCcLn2lZwIDOfNkn+POTmoass9uC+PdYlFhsuryQfMT4wij OUQdRVSr4i3L32JY5tZtrtKh9vXvTT4WaMq51FkOvTSmLMcZ3Y/S48h2BXGoMO2IDU4a T65F4JOniz7iGOJABIWo+ZUE4gaQ7FTiPF4aTYRqKaaLf0siwPXdbQjxgTx1bfB/BBSL hoJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vkdCHWTd; 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 t20si2013795otr.64.2020.01.08.09.42.27; Wed, 08 Jan 2020 09:42:38 -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=vkdCHWTd; 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 S1728991AbgAHPkL (ORCPT + 99 others); Wed, 8 Jan 2020 10:40:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:33682 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726651AbgAHPkL (ORCPT ); Wed, 8 Jan 2020 10:40:11 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 686072067D; Wed, 8 Jan 2020 15:40:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578498010; bh=Qt9LDIWUGUO8AwKrR+pqOOWNDm8AieMeRkfzNh2H+kc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vkdCHWTdj0Mpz7RLEyM9kW3sbDdPCR4Zw4TjYrKiptIkaeVqNtkGOPA2GsaQKOoJi +Nf/Xwm7WY+ikF/av4J6vEIvqfRQ72CxKH7EKhka3a6PVn9gZgzZ6Hqi/YrzXizPTb uzUkzTEHc6x6LdercfjGXe2vVwECzbevU0cGAIKU= Date: Wed, 8 Jan 2020 16:40:08 +0100 From: Greg KH To: Mathias Nyman Cc: pmenzel@molgen.mpg.de, mika.westerberg@linux.intel.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFT PATCH] xhci: Fix memory leak when caching protocol extended capability PSI tables Message-ID: <20200108154008.GA2448418@kroah.com> References: <572bea6f-06d4-938a-802e-93386acf59d9@linux.intel.com> <20200108151730.21022-1-mathias.nyman@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200108151730.21022-1-mathias.nyman@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > + 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, greg k-h