Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4122577ybe; Mon, 9 Sep 2019 04:42:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1z1fBzctGkBsrSdFkUthPN5bJh5uZmQSFvwcDXzwLoBnUBS/xRs2tuYKTpqpwj4ardqSE X-Received: by 2002:a05:6402:3c5:: with SMTP id t5mr23694785edw.22.1568029335374; Mon, 09 Sep 2019 04:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568029335; cv=none; d=google.com; s=arc-20160816; b=TA4ii11sGPP+Hvhjq+zFxXaK8Fhb1CUamIEqIJeZ5CJO1FWz9hJiyvOz1vIXhQ2Ull XNci5ijC2OhmbgSzjt1SBya/SYEeX3sI6pykM4N5yKPL25oHKgKDDaA5of9wOJmwX83m ghOKuELza55oUQrpUB1we9Ec1j2eES8RCTSuKWmJcuH2jEoHyIDGnYk4a+c6OWMvn2ns Sh/5y5CIQP2SIIubV3lPSiLmo8p/Do8cM4ALNcmzbbt7j8RFYNwM51E4j4QZukyhI0Zq VxEwFhEtzMs8f1u38ulAfvSuSa6DBqQn91zWZmoB2WujrbSMFKJ1L6GBLscvxQFmM13R BOuQ== 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=lKKehAVzTG4qZkYO9k1jaEWh9SJfqdtDYPcbt31hUx8=; b=D3BpE7Ct9pgtCxaStWvbnfvm1UDo1lIAkvb6CeuDuDcS4CJXQFksZjT3cxvdjuMANf UEZaN1n2228E1zEadxbwC5ZM+8eWXqwVlztD0MNgunwUY69w3MXtj7Y5ArB4WuCWEKwz GrDBAs3k014I3FYmhlmponsR1TLBOgHicypCGJCsH/VbijGDLJ6/Y+YNKV7zikFUPwXE zBu3Tbea+UwnF10FQAyIMXwT68yIVlSFx2aJYGb9yZZK6BCHg7cOwE9du+Seu83Knizh GTIhgWrfCr0ng1dUK55inygmjxnvCpSav6NrgODfJn6/FyvzUjNJyExAELCBW8/MOKEj c0Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GFfyVzz1; 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 i56si8097612eda.19.2019.09.09.04.41.51; Mon, 09 Sep 2019 04:42:15 -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=GFfyVzz1; 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 S1731310AbfIHMtH (ORCPT + 99 others); Sun, 8 Sep 2019 08:49:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:38656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731288AbfIHMtE (ORCPT ); Sun, 8 Sep 2019 08:49:04 -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 4C6972190F; Sun, 8 Sep 2019 12:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567946943; bh=IqEauNs7qeUy74R3qRiokvDUb9O7TGDvPagbktP5iyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GFfyVzz1kozti2CaYGKMk2eGz5KinkmezpuGtERySsg9xlasMi2oYewOBrPSmXiUB INCWLWLj5TmMb1gx0bu4tcS48QS8gGdjnY4iLnQmbMdlfhL7E8TwYHxkask8zuCSZC 08H4eexA+5817zI0xtRY5y+kCaHVIZleH7R9x6f0= 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.19 36/57] wimax/i2400m: fix a memory leak bug Date: Sun, 8 Sep 2019 13:42:00 +0100 Message-Id: <20190908121141.444791715@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190908121125.608195329@linuxfoundation.org> References: <20190908121125.608195329@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 e9fc168bb7345..489cba9b284d1 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