Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp269933iog; Wed, 29 Jun 2022 23:59:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vUGmanmldfAr7OKbhooGMVwfO7/8j7eqyKl+3Cr3kGDAjsNaTGzacCBGZVHCr3fkkxQHBF X-Received: by 2002:a17:907:1dce:b0:72a:4dbf:82e2 with SMTP id og14-20020a1709071dce00b0072a4dbf82e2mr3690104ejc.30.1656572346853; Wed, 29 Jun 2022 23:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656572346; cv=none; d=google.com; s=arc-20160816; b=VF8kBapStSngKT0hHan6n5/HNxrxrDYmHbFBBPrmlge1tgRZ64Lv0we7AMLajgCo1r sedADmuB4x2ETR8Bzg4MIBIt2tYiz61QN2IHEI5NrH8D8rTnlnLNMnJeIuKBPwaSxtGm tqcm10BBrDjjLF9YXoR52sBvujzcEyaFUK4G6JvWQwC+CiAlZT8+njeraKv48JpNMjRi mUazIKJFArm5QW7jRhFSfAzxH7ZQHiN38rpq1q67TSQ9YaC0s3Q5vhpGg4tIrec4pyK1 k2GIcYFBENOP/0+BtP5hIsKmwCV+IQswC6RR/s9Zyayt4nWUHFswit6cc1YLjM1j4fic 5Mjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wEbKRCRjbbpWPq8ECxeZtSwAGWfASP4KTHXVAe37YTk=; b=GLwuWOzCpnEHCWROCY8SjxnTm0fm+mCL+mydWSpJ5omN4vunScjhi5jpJNdpGQmHZx JJ1TK8dAAH/oOloLJi+qNq4RgP+DNvfiiaBmNs61e8zl+tnYT0RGBq9CD8hoXDFAlxDC jM46Zc9PJ/b5Wgw7jumUFhrtDhF1sDpwO86DUSBGYccWpHmFNMM1hVPxdbf/wG9YY87F Xm4i0bjbZ6QwzoiaVaDrW+vwG+KXZqJ2twiFexd+z/4o/baNbXdkFpC+Z4JjH95smeEG 8PMh1DNJHLryNKWIr989uUP+jAEmQhSEVkN/TfIqGhMXsTBwc9BNZUORKZhdlb92IAzM +3hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Kj6+M29K; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw12-20020a170906c78c00b00722dceb3f8csi8255702ejb.632.2022.06.29.23.58.41; Wed, 29 Jun 2022 23:59:06 -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=@linuxfoundation.org header.s=korg header.b=Kj6+M29K; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232434AbiF3GsI (ORCPT + 99 others); Thu, 30 Jun 2022 02:48:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229575AbiF3GsG (ORCPT ); Thu, 30 Jun 2022 02:48:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D15A93B6; Wed, 29 Jun 2022 23:48:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 881A0B82894; Thu, 30 Jun 2022 06:48:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC3F1C341CC; Thu, 30 Jun 2022 06:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656571683; bh=ZmAMu0njF2Bpk/IC0ycI008YD7CsYeOiDoicHzoH9u4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Kj6+M29Kbq3DuqjW/N5FyqDeZrXnQcTQxF3F8axdJiQ4ZzSylpSJxatZ8A43ZYu8m Sm0/VdPemmcZ5MH98lnTs/t/YKJIBB2BEkghAFut7X0mdQ6qM7QoQBxr+sVMqe5GEb +bYXDjFCVT/C4U9/iBqbd1TWWoeoOWIRsLW4RBVg= Date: Thu, 30 Jun 2022 08:48:00 +0200 From: Greg KH To: Jianglei Nie Cc: mathias.nyman@intel.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info() Message-ID: References: <20220630011008.2167298-1-niejianglei2021@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220630011008.2167298-1-niejianglei2021@163.com> X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 Thu, Jun 30, 2022 at 09:10:08AM +0800, 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 > --- > drivers/usb/host/xhci-mem.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) What commit id does this fix? thanks, greg k-h