Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5600799rwb; Wed, 7 Sep 2022 05:29:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR7vx+MGcMgCDCs6uZ9oGSWEgDePDo7nzu3SweFmPKTAb1LIi/kqPqDgEdr1E7I6lG2eMDyP X-Received: by 2002:a05:6402:1946:b0:44e:a406:5ff5 with SMTP id f6-20020a056402194600b0044ea4065ff5mr2978191edz.14.1662553762906; Wed, 07 Sep 2022 05:29:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662553762; cv=none; d=google.com; s=arc-20160816; b=MriTHcoehmvxl+F2scfjHoiakB3vciNnLtoVEy7nSVWR8jSVq5it+ItBgQjCrAq2GG Cp4eqZgDWtq8KvnE3/k6Qmbdfiwk+edfppXXZrrTe4FJZe1yiFcjCCHS8dlw+JIXD0cl w4o6jcpV5lxSRrgAv6lEk4NORRwjMsCqsQR7ILBGBkabNGA6D2GF6W/4gOP0PPyASGCQ 00a/LXZd3nAxudlMoF8uCHJJE+ZovhxftlwCcf2Xe7qh2L/CNNE2kCZJ6oaPzk7ndEG7 /6luF213CrUVNJT0aTuyMJDOYFGAYRr6MttiPQlwy3td8Pu4g3olFwGU+Dhk32+em1CD CrWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=KHIzh8Yi3r/1bHxpq95qzQeIKT8dLe5Cq+j0l6ESGj8=; b=njfsuCW2sDgOxbeiloExBSDa6TlAl4IQ1xyEk81Dt9FQsiMPH6AGSbJnMY/WbjnNnj 7xAvc1D/9C6I9YfNOUtto1vGNl9uPJLs/nFYixGiE6y0cZirKYv/POs9Lk+1ypEzOzsB LIJem+oj8gV8IWMCU1RdFV430iDKAJGbOAofEhIEdJOAMHgVpMQRz9YvjTjJuSIX+xjP mOKu4Kb4PRutMw6sCl9U0hT/NPsZvurEYEdEv3ib5tLTiJ3Cswtwf5WpeGr/EUE0/L6k ztd1dfN+4wyrMITNch/mSieGd3G1lCmVIgnpz+8CNgJJoyUTh47FCJx6XLv9/I5j259r wnTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QCOAfcKQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr2-20020a1709073f8200b00741555776c1si13646096ejc.680.2022.09.07.05.28.56; Wed, 07 Sep 2022 05:29:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QCOAfcKQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230168AbiIGLlK (ORCPT + 99 others); Wed, 7 Sep 2022 07:41:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbiIGLlI (ORCPT ); Wed, 7 Sep 2022 07:41:08 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCD2D796B9; Wed, 7 Sep 2022 04:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662550867; x=1694086867; h=message-id:date:mime-version:to:cc:references:from: subject:in-reply-to:content-transfer-encoding; bh=39OSOMlRyCa3uy7nd4l/z0VTCDqPadzfIU+GqUXnH28=; b=QCOAfcKQcyW9yovLjABM6j75Lnyo4sIF6czzi1DZM4mXkFzMos1nHDWc UAg+6YNrzzr6ii6vKy+tbdFGdGhtL+Iy3cXkmj05SP/L/kZL0MvQBJnqd 11r3Zb7e9sfWZvgQPH1Doyzafple92UPc8G/cbeogIyhw5Hnh3VCldFxE hTTVsa6arHCkoWD6Qj1aKkWDmbJydXo/msNyhyLSi889USBpwNpD32GBp JmROPEmM13bnZdLhzYkvRBMWq/wrQf1l7k73OQ5CeYHQKCmvjBIJ5RswF P3FxkRsYwwf1iMqyj0D29iQsSQhew3YBJIETw656UdsyWtdHrDZd1rzDj Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10462"; a="360795078" X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="360795078" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 04:41:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="676150254" Received: from mattu-haswell.fi.intel.com (HELO [10.237.72.199]) ([10.237.72.199]) by fmsmga008.fm.intel.com with ESMTP; 07 Sep 2022 04:41:05 -0700 Message-ID: <5b38337c-6d39-de07-961c-e84eb05d5981@linux.intel.com> Date: Wed, 7 Sep 2022 14:42:24 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.11.0 Content-Language: en-US To: Jianglei Nie , mathias.nyman@intel.com, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220907074850.59693-1-niejianglei2021@163.com> From: Mathias Nyman Subject: Re: [PATCH] usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info() In-Reply-To: <20220907074850.59693-1-niejianglei2021@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7.9.2022 10.48, Jianglei Nie wrote: > xhci_alloc_stream_info() allocates stream context array for stream_info > ->stream_ctx_array with xhci_alloc_stream_ctx(). When some error occurs, > stream_info->stream_ctx_array is not released, which will lead to a > memory leak. > > We can fix it by releasing the stream_info->stream_ctx_array with > xhci_free_stream_ctx() on the error path to avoid the potential memory > leak. > > Signed-off-by: Jianglei Nie Thanks, good to get this fixed. Adding to for-usb-next and skipping stable as hitting this path is mostly theoretical. -Mathias