Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2529379imm; Mon, 28 May 2018 09:49:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpWxVCbaSQ1FoIj7HMy1CwzuMUFIazks/ucJihMIajjCbvuHxSyqNdsdq5SweaKoxVgbsqt X-Received: by 2002:a17:902:24a5:: with SMTP id w34-v6mr14274859pla.52.1527526177942; Mon, 28 May 2018 09:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527526177; cv=none; d=google.com; s=arc-20160816; b=Eaiv103UaCowrjtrLva7zPdariuEPUyZ2naPxfEk56rCd1llPs4lOHAha5TCFT2/fl APvLl4iD1eHzER2QsrELY1ZMISLCABeX6l9W7dVbg6wKaoJxzqpk4scuS+/XJmAM4gVB sMwmAilb0wA/fnGsYLji0Tw9ufXi7bQtzAVvij9ax4vBzcmBn/ugOf0PIrX7rvE///iY /T4OE5hQRkzXaXomtOSIwkDxmuyiyCROMCPBZfXh7aGUQy7TKggLrIFKZUcv0Fma7oN8 nEn9A0NvvrHsy+e8jp34kon5cPUMYphuQCdMwY7Oujcj0HAbuXDdICD0ZRdOVQu/VW43 4QIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=4M7rH3Mz9OeyDqs8TqLin/oTe6cFI1jjvp1wTMSOpOs=; b=C9dqdtOXnR1QdqnYAQ9o6tzoXyA1kH6/Ath246L8rmdekUTAp6x4VZlNeWhwuGi4fd h0M6WCHaE9/N4sfPvKO0COYGYAUF7R2AkoEyTQrY+YEpOPA4lbYOdqtIph+pLIrd9uqn 1tuc7+tzJrV2h20fSDNpYAOlIaTmQjfQGrS5aSH4UFGdCa3lwpw6ZzOI74JPuOjsmUbN QI0lnRUpNiXb2FqI1Z14OUMaxFKCxzjRVT79pxM5UBo7IjdfnpStw9jkiWndjvHkHQR4 iNfrNWXZCEuL+yOT9g5Mg71Q9icPULn2PExN1xAILptRIwAv1AIQXJSvDNjlBXwYpRGb 25fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oN1p0Rmo; 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 w61-v6si1375277plb.502.2018.05.28.09.49.23; Mon, 28 May 2018 09:49:37 -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=oN1p0Rmo; 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 S940371AbeE1QsW (ORCPT + 99 others); Mon, 28 May 2018 12:48:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:54504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754566AbeE1KGd (ORCPT ); Mon, 28 May 2018 06:06:33 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 8E67D2089D; Mon, 28 May 2018 10:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527501993; bh=/j3bTceLU7UibrbgGjw/1XuDo3iyr2MegxT9xJGAbOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oN1p0RmohKLaIChwMRv9HS08Q1YhdumMc7S8/pj3QVlcq6kPm/VRh+zwOA6Tu/K3z M/vINnfJnKzIrRDZpIx5yugs+nWxkHqUb+4uXqy5FqG/zRGwY412+EB1B8eYinfnZu xkiH1FPzY9mJhYr67LqggACMxdvxDvezi52qAXc0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ulf Magnusson , Masahiro Yamada , Sasha Levin Subject: [PATCH 3.18 021/185] kconfig: Fix expr_free() E_NOT leak Date: Mon, 28 May 2018 12:01:02 +0200 Message-Id: <20180528100051.822203418@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100050.700971285@linuxfoundation.org> References: <20180528100050.700971285@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ulf Magnusson [ Upstream commit 5b1374b3b3c2fc4f63a398adfa446fb8eff791a4 ] Only the E_NOT operand and not the E_NOT node itself was freed, due to accidentally returning too early in expr_free(). Outline of leak: switch (e->type) { ... case E_NOT: expr_free(e->left.expr); return; ... } *Never reached, 'e' leaked* free(e); Fix by changing the 'return' to a 'break'. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 44,448 bytes in 1,852 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 1,608 bytes in 67 blocks ... Signed-off-by: Ulf Magnusson Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- scripts/kconfig/expr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -106,7 +106,7 @@ void expr_free(struct expr *e) break; case E_NOT: expr_free(e->left.expr); - return; + break; case E_EQUAL: case E_UNEQUAL: break;