Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2831905pxb; Mon, 11 Jan 2021 22:41:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQSOLmGAIlmaMkY137j55mwMD6Kj5Zvr5VhpTCC0fgIaWzKmE07f9FaQG/TwqidUzofE5s X-Received: by 2002:a17:906:4950:: with SMTP id f16mr2247669ejt.453.1610433704679; Mon, 11 Jan 2021 22:41:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610433704; cv=none; d=google.com; s=arc-20160816; b=JG+LdpOIQ+1Bk8PpX/G111fUz0bJ1es0l2Jq/ayGFT+yCPVCcaQoCZLergBs+ILwBS u5EUwInxd4hzHiN8p7vJIV2LizLUPywk3y2aPFEkAuu49BJoWZC5QQXrLAno2A1ZiOVt v/bQeyk2NSPd/O5GRza/lceMr83K/c220xfumXuCG70kNZxigyc8TrBaHOhK4OEWKTqo 2PQSalMIxBEvJXxRevODfBPWGpcEHWptZt+Qmts49WUrvirXl2Wsv7/cY1CZofEAIU5X ipncv6RYM+wR2cbyEdD9XSjY5ZgKz2uU4XyayMMVSRJhSEHj6Dl/YX69xR/GP85CkVso VK3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZMwpSIfGbnLECkiBtStrjZikEcfucklG/MSar4S4ZEU=; b=bzg9H2B704S+oPzY831rKZnAE7imDIhNKfTCVEz6twKM1rrUnxbm6ysnfRg+ujV4Et R5v/RhHbCgeU3CDv/Ho9e17DD7KQb+7cYFFBUSLKly5qnbn+ssj5Qq9vEoYBYCAKLc+v A6N4/6oEDNFN+CvDbfmGrEdHzz0HE/btopq5lwgGGbF+9cq59MZUjnGxGAHY2N6OjT/O AgSlEcAVqOAZtDnR/XKdUXRnbZulaIspQy1hS5r3Pw5ZZzJsvl9edhhRq08p/BnKCf93 HcDbFprWdo72PTCZBtkrr2euILpLSyvRrHQCkJfp33V0+OHpgh1KrmQ55c1YolNXczWi mQvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qSNS4gKl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i6si905510edr.148.2021.01.11.22.41.21; Mon, 11 Jan 2021 22:41:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qSNS4gKl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2387909AbhAKN7d (ORCPT + 99 others); Mon, 11 Jan 2021 08:59:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:54252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730332AbhAKNGj (ORCPT ); Mon, 11 Jan 2021 08:06:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4C3EB2253A; Mon, 11 Jan 2021 13:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370358; bh=RyRG7Ew7Fhx1uG6XuuHnYGk3jC8YyqdcwwrHOha/xHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qSNS4gKlpza4TsR7O3w+Q6gBUttto86XVzSX9QApn51VapxLv5xEqYMExi+rLzkOV xXP5jUCPuuhKCTNqfopmzzv09CcJS/Rw1geGU6arRkpXerEp1LYy3KLw6n1OMS1u+z RiXbz+7w68zv7KZu3KnERhVFe59jThdNkfNMSZ4s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Chen , Zqiang Subject: [PATCH 4.14 44/57] usb: gadget: function: printer: Fix a memory leak for interface descriptor Date: Mon, 11 Jan 2021 14:02:03 +0100 Message-Id: <20210111130035.854402438@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130033.715773309@linuxfoundation.org> References: <20210111130033.715773309@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zqiang commit 2cc332e4ee4febcbb685e2962ad323fe4b3b750a upstream. When printer driver is loaded, the printer_func_bind function is called, in this function, the interface descriptor be allocated memory, if after that, the error occurred, the interface descriptor memory need to be free. Reviewed-by: Peter Chen Cc: Signed-off-by: Zqiang Link: https://lore.kernel.org/r/20201210020148.6691-1-qiang.zhang@windriver.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/function/f_printer.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/gadget/function/f_printer.c +++ b/drivers/usb/gadget/function/f_printer.c @@ -1130,6 +1130,7 @@ fail_tx_reqs: printer_req_free(dev->in_ep, req); } + usb_free_all_descriptors(f); return ret; }