Received: by 10.213.65.68 with SMTP id h4csp2119191imn; Sun, 8 Apr 2018 20:10:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx49iVJv1xIktf9l630Sj9uqTSMI6O7ZyDnA5bJl5VFGC7r3xVzHrVb6dRJbGoeOoC/XJdf4n X-Received: by 2002:a17:902:9894:: with SMTP id s20-v6mr28910677plp.196.1523243445662; Sun, 08 Apr 2018 20:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243445; cv=none; d=google.com; s=arc-20160816; b=ed7ANzNkzBNdHW2QR0VTXPsOQGiwfGg2m9QsWUt6AglaP9yOkTZKSUivkzufJaP4J2 8SWBZhmHUVMH1mxCB1nl6tL48KsUcelMeozPof9SOF086PR4slf14VFUE4u+KRjagNHq FFtQ3zc8IAZGsI5maDIBldPZa11zFP+4Aku6dVio3tU0rKUAYftuqzm0gDV47NrptWWx lYKNz87Dz79btvtuY9TdA4wnCY026RQZRspv2m9Nzs4sKJsaEKqSa0EtId78Afba3Zt3 VTkFS2NXamlxmVStQQrkG6Pz7+qrkcEiEGQQPr4vFq+qo8I89hNRv6SwhWqElHc1NEhm KgZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=PgB3nQNheTO+n2hNSbOP+bHl7pwilIW9rNRcSd/Bggs=; b=gzESXrPySo4rB6oKR1ThHOf3BFJi9lHgVR5AV+1dfcitF6sw4jSCBxRYgRA4mXSK2S i60yFBYmX3dY4r5dSnw4NEvimOHuyTO9kr4/+wn1VNIdw8L3aSqBmyGoIRKIhM99o0/r uZIQB/tBRe+13z8XLrOi9zJKchsYUDENtyaPnmasa9gLCxQxI2tn+CRenLAk43cNb0JT E/wn1aE0KN5JKwhA53OL/8QNGWqaZVwLvhJ4k89Z4goc+fdTpjcIi0HrpcEboXshd4Ia eFjYPbM7ICOdpXJlKC70/w1vlwgLGDP5IHbWM2jrcE0p0Zd2un98adW0UMEhMDzHHT5s oqww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=gz/wFsaA; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si11551819pff.280.2018.04.08.20.10.08; Sun, 08 Apr 2018 20:10: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=@microsoft.com header.s=selector1 header.b=gz/wFsaA; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932441AbeDIBys (ORCPT + 99 others); Sun, 8 Apr 2018 21:54:48 -0400 Received: from mail-sn1nam01on0094.outbound.protection.outlook.com ([104.47.32.94]:49836 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932224AbeDIAdL (ORCPT ); Sun, 8 Apr 2018 20:33:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=PgB3nQNheTO+n2hNSbOP+bHl7pwilIW9rNRcSd/Bggs=; b=gz/wFsaAIrKBwXBNXH4610xGskg43QqBV0+wZgirMRYqY2E1geYwXwO5FKzA5ldeDpw1J7TWOzbyY8gYUjcub1UzglYYZKq4mSmHOQ8GVkA8ujh5Z4fgEdohgCdBJF603V9sm5QbOViSQNtc7ift6RFte8ckzEYuLt34beO7398= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0902.namprd21.prod.outlook.com (52.132.132.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:33:06 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:33:06 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Ulf Magnusson , Masahiro Yamada , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 234/293] kconfig: Fix expr_free() E_NOT leak Thread-Topic: [PATCH AUTOSEL for 4.9 234/293] kconfig: Fix expr_free() E_NOT leak Thread-Index: AQHTz5lTtcWk+j+ob06riIQzDxMbbg== Date: Mon, 9 Apr 2018 00:25:56 +0000 Message-ID: <20180409002239.163177-234-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0902;7:7Tbro8JoGbpQOil+tHstQ+vCa905yH1kP1cvJG3yh6Z4X6/6r8BqWAZR2zC9LHMS8Kc5i6jQZZtSu8k50Ag3Yg4e4UIrzylSlwMWgsgu2bHSFQpZ3FoTifm4xCfAKLpWnYydL8u36gzBJWtXGpkvt1ofiFF1dmExHi9Y+7g1dj/yMqF5NM4lbLp2ObC6vSdt9qkWDWNXyE1Fk4GkUplVLzHkt3hVeC8sYdBn1RnPmq/deA6UX1QePBhgX8rQq4Fy;20:8VpsQ0YLVcMdTY98ivOMlCCx/Ky7REqGCyl6/O3h/ztecdVx8Jm4PewtIm04YkrFazrgyTKZ7Kaz30lMNgQJ0UpeC3Xy2xjbwkp2/EOmPo4uakkqqm/bXTmjSHiyMc1Ntk3CdYlFlFBPuNUl5/3IqoEW5Izb7m5qD2+lPIM0MJA= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 5c9ad99f-ab55-43ca-07c8-08d59db17677 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0902; x-ms-traffictypediagnostic: DM5PR2101MB0902: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0902;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0902; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(376002)(396003)(39860400002)(39380400002)(346002)(199004)(189003)(5660300001)(478600001)(86612001)(3846002)(6116002)(106356001)(25786009)(6486002)(72206003)(10290500003)(8936002)(6436002)(76176011)(2616005)(6506007)(2900100001)(97736004)(26005)(486006)(10090500001)(36756003)(81166006)(8676002)(81156014)(59450400001)(102836004)(2906002)(99286004)(11346002)(476003)(3660700001)(66066001)(6512007)(86362001)(53936002)(105586002)(186003)(5250100002)(14454004)(22452003)(6666003)(2501003)(446003)(7736002)(39060400002)(316002)(1076002)(110136005)(3280700002)(68736007)(54906003)(107886003)(4326008)(305945005)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0902;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: x87PUTnM5528vpJR+F8wkTpYBD7mbStmAB5L9A6W6xxCXqeb6wUjYUzu2lSwf6jDMA9GC6gbDyQ7T9N2R0PobS4ggoyw4RhYDLVhNjJbYcvjsMZx73vpWt1yr8mtW/BNrsw38Rcax0kWin1ThhUqLemTvrTAZvjG7GEQOjFa0VYPsRUnPppuuWUagTH5Ds58Z4uZrHpR+zvQRj01EN/jYobRWIoXirCUmGj+dfEmmmgxMFeglxMsYJclsN18qw8rRCYPOVdRc0EhDlaoq+TSG/6ru/EcZyfzma77+j/snQBOjLaT1HrE9UnDG++G0HEGFqzfQ3VMzTNcwFi1iCfl1VP5GS+ZCDO+RluP1FIngpUS8S9pS1WXaZmquY05YJPK4X+KyY+KrSgh2GglABRNR9eS8dAzo04c3Eq0J/evVbk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c9ad99f-ab55-43ca-07c8-08d59db17677 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:25:56.0817 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0902 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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=3Dx86) 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 --- scripts/kconfig/expr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index cbf4996dd9c1..ed29bad1f03a 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -113,7 +113,7 @@ void expr_free(struct expr *e) break; case E_NOT: expr_free(e->left.expr); - return; + break; case E_EQUAL: case E_GEQ: case E_GTH: --=20 2.15.1