Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4076534ybe; Mon, 9 Sep 2019 03:55:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDsv5VOY8G6dfGTsrn0YfUzkDrb8lD48QFjDyI6D/xOYuc4UXcqs7VwlK6KHHWmM8afBdC X-Received: by 2002:a50:b582:: with SMTP id a2mr8160243ede.98.1568026545489; Mon, 09 Sep 2019 03:55:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568026545; cv=none; d=google.com; s=arc-20160816; b=fxW3COiCEG94JrL5Cu/9I8KakHcozJ0xB8ywk0nWV3gbO9Wtan4m/6FseizvoiSL7e E7Fx/11eejDrcqa2RZI0R2DBkfBzoHb85uAwNXZfM+Kn8YJQURVrNQ0whcwTdZP7msWQ mycb9BJ/jN6v0juJzjD6DQP2HjfV+9bYGsGaH073wvuAjULboa8VjwKd60hP3+elbNSy p6M/Mc7Aus8TF7lYD8ADX2OqeL/dX2xUAKME+wemEIqldP1/XwSHUB7+pu+1//wYvUIq coq1LUuhoyKO/IjU4XKTN1xuOiVvh2smxt5xZAuZHvzLeBKGKIe2raIrAez6nV7FV/DQ IIdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rzP9hOufeddRqQY3jYxn6f2ovQ2QhgP+FetAhQx2+pQ=; b=b4/S7XPlfROQQPYWqb9Jo24w0iyVuRGHsqNiNTmcaZ+JDvOhkJv9RFeWTDWITG96tV YtzMfiGI5AyR4cCR7hka5o9etaujh9iv6IUXBl9Yg63fbQeokjEp4PB4RqvoJkTkIsX/ PJgn6efVGovFM0B+TlrOyPaLYxP/jmnddnUTS5w6ju62X9Km02svpevL+eWZkO1ww4xM /WrCXF74Px+9eBu3FQ9lyq/Ojyow6nyyssOwGgwgUoRq+IfBdlDJoZku+rOykwoyW/2Y Bc2i+e5uTEJhIvD3V8BjXzUh0M1CJbLFG1jQ02c4mBs2I+ASVE02QiDdwdm0AXIPOYbj IsjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KCPiUKcd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id re7si7268954ejb.349.2019.09.09.03.55.21; Mon, 09 Sep 2019 03:55:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KCPiUKcd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729651AbfIHMn7 (ORCPT + 99 others); Sun, 8 Sep 2019 08:43:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:58298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729632AbfIHMn4 (ORCPT ); Sun, 8 Sep 2019 08:43:56 -0400 Received: from localhost (unknown [62.28.240.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0CDA121927; Sun, 8 Sep 2019 12:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567946636; bh=mqnRnbDGslsvYo8EJuwu7K/kmlaG/SNDh43N8rER6D4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KCPiUKcdvF2vQcUQXRBXtl2FKI5JOIcR/px25JrGneie+khx4hzAm98d+jJJR7i/L uoOR4RVvAY0koMbEnW1uemmglzoFMV5TqWHv4Ooe7eboHgXFFV/RSP0QAE9N/2Afxh pqcCaHhf3Vqf+3j0JFvfcYqdg+u0QaGJiFLHJJUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenwen Wang , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 10/26] wimax/i2400m: fix a memory leak bug Date: Sun, 8 Sep 2019 13:41:49 +0100 Message-Id: <20190908121100.927195462@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190908121057.216802689@linuxfoundation.org> References: <20190908121057.216802689@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 44ef3a03252844a8753479b0cea7f29e4a804bdc ] In i2400m_barker_db_init(), 'options_orig' is allocated through kstrdup() to hold the original command line options. Then, the options are parsed. However, if an error occurs during the parsing process, 'options_orig' is not deallocated, leading to a memory leak bug. To fix this issue, free 'options_orig' before returning the error. Signed-off-by: Wenwen Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/wimax/i2400m/fw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c index c9c711dcd0e6b..0e6c665a4de82 100644 --- a/drivers/net/wimax/i2400m/fw.c +++ b/drivers/net/wimax/i2400m/fw.c @@ -351,13 +351,15 @@ int i2400m_barker_db_init(const char *_options) } result = i2400m_barker_db_add(barker); if (result < 0) - goto error_add; + goto error_parse_add; } kfree(options_orig); } return 0; +error_parse_add: error_parse: + kfree(options_orig); error_add: kfree(i2400m_barker_db); return result; -- 2.20.1