Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp250873pxu; Fri, 11 Dec 2020 01:11:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXcQFwWpDG6G4XHo0Wuw/Uw0Qqg7UfJUXW0C7zb84arg/Wz7PLi4mYczzG7rgx6y5SK8W/ X-Received: by 2002:a17:907:2131:: with SMTP id qo17mr9942089ejb.546.1607677875763; Fri, 11 Dec 2020 01:11:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607677875; cv=none; d=google.com; s=arc-20160816; b=0mmQcbOlR+QAPNM/vYYWgXUe00H76lWD6QlaxblS3LilrPl/g0IkbrxaBHP7VZl4He FlDpxZ7Sjl6lYOaJJUp5LweP31DhPjdfWLvPiv/8ZxlhUHKL8iSEcbI60cbFlvlEcpsI ld0hX0wLm02BE/7jWZVkIOPUobyjKqZsCPmwInzWG3d5Fa6CkorwntcmkReAExLRT9oq RWzwE8SUum8qaHav9OZoxfMuRW6Xm5fAAFqsoqCIu013UBTvi9zHTysY4yvw7J0OjnNZ NHKM4OyXQIQNNlD8S3lIqcyzz3j9ynMFeDFJbi5F0qVyI4pJZcAqOnOFXxGXsNqoZVyx 6s7w== 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; bh=pqINa3Dx9ca51pZVccgWwX7IyKEht3mbrFmYm3qs3Vg=; b=I/F+CsHtDc5o7ix2xKQgvc9AM16dedEh5uTee2m+P4ftob7aZOlQAuErxDz3cJuQRm uaDUbFheAhoEv31X3rijPqn0wTZLWslQD2vJYTvv0xTUwuj/aMDVa0gcWOd+aoL6yjhV xLa7ao9exWjte+hIztVYr51yDlgKMZEDx6vN7qbAHRU0mA4D0e1QnmTUp/w9f+PDnK1X /DyDlOM9dCmzraO7dfaRCD0AU7dMAhz8QctpXH4RtHMUbK39uXSt6shf0aXolk7QVvQz /btE1pBLJBt7tlLflUGM9e2UAHZXhfarVcMn/BYMuvahXO6rTRcYxhb7Mdz3INvaG8us Gc1w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 r23si4594892edw.310.2020.12.11.01.10.41; Fri, 11 Dec 2020 01:11:15 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390430AbgLJTXy (ORCPT + 99 others); Thu, 10 Dec 2020 14:23:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:38684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390143AbgLJOam (ORCPT ); Thu, 10 Dec 2020 09:30:42 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 4.9 23/45] USB: serial: kl5kusb105: fix memleak on open Date: Thu, 10 Dec 2020 15:26:37 +0100 Message-Id: <20201210142603.504327215@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201210142602.361598591@linuxfoundation.org> References: <20201210142602.361598591@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: Johan Hovold commit 3f203f057edfcf6bd02c6b942799262bfcf31f73 upstream. Fix memory leak of control-message transfer buffer on successful open(). Fixes: 6774d5f53271 ("USB: serial: kl5kusb105: fix open error path") Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/kl5kusb105.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -293,12 +293,12 @@ static int klsi_105_open(struct tty_str priv->cfg.unknown2 = cfg->unknown2; spin_unlock_irqrestore(&priv->lock, flags); + kfree(cfg); + /* READ_ON and urb submission */ rc = usb_serial_generic_open(tty, port); - if (rc) { - retval = rc; - goto err_free_cfg; - } + if (rc) + return rc; rc = usb_control_msg(port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0), @@ -341,8 +341,6 @@ err_disable_read: KLSI_TIMEOUT); err_generic_close: usb_serial_generic_close(port); -err_free_cfg: - kfree(cfg); return retval; }