Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2405288imu; Thu, 24 Jan 2019 12:11:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN6CzVR3qhLlE/Qz+67gKgiFEu38Opi+gwbhImfYzJ+oLinelBoGTr8qflAUaJOsGkHrzLDk X-Received: by 2002:a17:902:a411:: with SMTP id p17mr7864194plq.292.1548360702101; Thu, 24 Jan 2019 12:11:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548360702; cv=none; d=google.com; s=arc-20160816; b=Cd3syBvuyisyXn4p8txvry3H6d0WYY33vEPfQoa8A3MFWCVutduW0gmIOLswqUK1iT SB5YhUxBGTFLAtu45i793dw0QVU0HRBg9lwBKNi0syhN1im3zzpZYKdWusPrjdSUVQI6 15494TJdjj42/Kbm6toCO5lvuU3Gv3VcmDWrb7mWiCh48GnG+rxpNv6qZjon4DWRXN2P rBcquNIngV1vLnP3N+3mkMknyyAwkpkIPOfeNfZHluLVTvT5i/qwT3MvSI7jiTZuOTxL E1/VfJlxe+Gm5pSWoqOEJS1SgzPqdzwOtHMalnuzQuIgUGw3UKrd7Jng2uQ6Jf2xwaS4 24XQ== 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=H43ErV6WuvOsyMFLZU3htKVBzSdAPIX6MAQjOx8jwrA=; b=bUJxYahNlc4IxrCjNCg8cDBp2ajQd+bWQ76yo0HPsN2SrIis3rRMpzhhRkEmCjTaRN t02sfKcUwtOejzA4W9nv2Vleojjs7OQfgziCTL/aegd2AoAPOPmODrQn+RAND+ijgXXJ EVIskJx1DeueFVSCbpU1Sda2qFe2+f0uckbbxiUGC7Y3Sx20CYP0ebWrP8G1BlWWpHit m5itKza2GrDAKm1BJ9ibxaxlqyrvO3CQAxFo11RuSzPtb5tFI1RjAM04QN5zvBWLtC9U vYDWeYjgz4CDNJiWE6lyguWMo56F7GMCkFOw4Cs9xuNwJtY2n1fRGnvJtAQNaKcpVphE 6CCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="X3OCE/wL"; 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 a19si24644532pgn.102.2019.01.24.12.11.26; Thu, 24 Jan 2019 12:11:42 -0800 (PST) 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="X3OCE/wL"; 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 S1730852AbfAXT16 (ORCPT + 99 others); Thu, 24 Jan 2019 14:27:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:54274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728590AbfAXT14 (ORCPT ); Thu, 24 Jan 2019 14:27:56 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 D9AAF218A6; Thu, 24 Jan 2019 19:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548358075; bh=OQx3F/WlbRfkgK6s5YVXihIbrWbE+wANmVbwprnWGzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X3OCE/wLKG0HoQ2ABSz4CGM3mejwgbaaHMunbe82nqeSH3ThKVUYdd+kW4HQ6Cabf mWOP5fr+XjwJzuMDzbIoo6YJTwy8QRUOui1mDnhnqhVhY3p982AiF+jC9Aw+mNkMnv 5LKfJ7vlcXx1ZbTs5DiOG/ItMlnFvyB8vpl1P6+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Sasha Levin Subject: [PATCH 4.4 090/104] kconfig: fix memory leak when EOF is encountered in quotation Date: Thu, 24 Jan 2019 20:20:19 +0100 Message-Id: <20190124190204.820592412@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190124190154.968308875@linuxfoundation.org> References: <20190124190154.968308875@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit fbac5977d81cb2b2b7e37b11c459055d9585273c ] An unterminated string literal followed by new line is passed to the parser (with "multi-line strings not supported" warning shown), then handled properly there. On the other hand, an unterminated string literal at end of file is never passed to the parser, then results in memory leak. [Test Code] ----------(Kconfig begin)---------- source "Kconfig.inc" config A bool "a" -----------(Kconfig end)----------- --------(Kconfig.inc begin)-------- config B bool "b\No new line at end of file ---------(Kconfig.inc end)--------- [Summary from Valgrind] Before the fix: LEAK SUMMARY: definitely lost: 16 bytes in 1 blocks ... After the fix: LEAK SUMMARY: definitely lost: 0 bytes in 0 blocks ... Eliminate the memory leak path by handling this case. Of course, such a Kconfig file is wrong already, so I will add an error message later. Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/kconfig/zconf.l | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 6534dc5ac803..0c7800112ff5 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -191,6 +191,8 @@ n [A-Za-z0-9_-] } <> { BEGIN(INITIAL); + yylval.string = text; + return T_WORD_QUOTE; } } -- 2.19.1