Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5031771pxu; Thu, 10 Dec 2020 11:09:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyknSDyWHFg6w/67oCkfeqjCEc04jRnKYFCmcLnOFXzd2+H188noUNbbs+7mB74cec59yWm X-Received: by 2002:aa7:cac2:: with SMTP id l2mr8255183edt.141.1607627348705; Thu, 10 Dec 2020 11:09:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607627348; cv=none; d=google.com; s=arc-20160816; b=eJKZhLIzCI6w66FrOwJVtCwUaXboSqo8Z00N5LjhacPu2RYGpRJp7fktf7QqSiq7WS h/+dfT1t82iVUAxO7d0r6cZfK1cU3XSy8+auhmhuO53pgHHp2kd2RHotk0Ga+ih+ewdj iaqJIWBQiqhWoo0PPRi9Sr3owW10NEbS2Q43ncvcOPW2MsL7kXrNVxZxZMyGQEGghYd3 L+Q7tDFR2/BJumCksWGh7HcGjz8NufDgofyFIvPYrstghqJs8hb0jwvSdaTQkjRq+9Rb vy8GzPXUSBTgt8DlsjU0SdzJ8WZSG5isFYHVVTuf0afuJuqavguCd7cLur6PEi8kJj8U KGyg== 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=+onUoliMhUsnb+FvQWnmIXx1zEwP+3NV/5K4wHfbZNE=; b=yyiQ/QnFhWWdFL2cv9BmZFlwycnAEhWczZtCFKVqHx9KJqT3xZMqpKT1HhhzyaNbqL Aq+Wkk6LW02Sqk3thPDyaPAKmO0XAqGxCFtwMqPD87iOOZUWgEwkj7ZxJB0NMCbuIe6B vgSrC0PdBq+WAJM0wXtJOaAzfRqjk4MqcjKsMqeefLIuMfwbQCbknf2bhUww/yDHSSGC iVbgB4nOa+UHItSX1vZLCMeyrZ7FlLBC2njUb7xoq8Bp71b/Wg7hailGRp18EgXQQZQk 7NJyJaGybmzxcp7ZV/l1bkY6QB1kpIhKUGxOS1Y/M3vGaBZbSc0lTA4ugKmxcWZxdm4K 8vrA== 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 t19si3153317edt.283.2020.12.10.11.08.45; Thu, 10 Dec 2020 11:09:08 -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 S2390487AbgLJTFT (ORCPT + 99 others); Thu, 10 Dec 2020 14:05:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:38582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390471AbgLJObK (ORCPT ); Thu, 10 Dec 2020 09:31:10 -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.14 06/31] USB: serial: kl5kusb105: fix memleak on open Date: Thu, 10 Dec 2020 15:26:43 +0100 Message-Id: <20201210142602.413492610@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201210142602.099683598@linuxfoundation.org> References: <20201210142602.099683598@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 @@ -281,12 +281,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), @@ -329,8 +329,6 @@ err_disable_read: KLSI_TIMEOUT); err_generic_close: usb_serial_generic_close(port); -err_free_cfg: - kfree(cfg); return retval; }