Received: by 10.192.165.148 with SMTP id m20csp566827imm; Wed, 25 Apr 2018 04:23:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+zxjEzsQ/jkxxNd7gcMKa2r4uWhfPOJZMnjDRDoNsmELaXcyOXB7JcjsBZFQ6zSivHOtcu X-Received: by 10.167.131.92 with SMTP id z28mr19096546pfm.237.1524655409087; Wed, 25 Apr 2018 04:23:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524655409; cv=none; d=google.com; s=arc-20160816; b=vGCeeN5Qk2M8WRx49UzaKO4kTEDp/Bt4azIlYUF4/kRWGd9DphEvI1OztzJeriyB2N WP3VYQJaa++PGxcuGn/ciGT3CQ9CP1J2MZR807THw4+DAjbjoZRSt+1Tre4iQ496+Rzl DOxkJgbbmF0XN3z5LWxVimL4yAFPD+x0se16MrDLN6nl4oDzK/lhKh5SyqaIu0PdySGr VUs7UA/yRnK5Ewdf0W6XpKm6i2pmoqb6Ru0LgUc3VOFfCZT/PblbbKV67m+xdWsBgEpT A22QakKTdqej8jf9HJFHGXp3CSW04AevLvaNXBR3VVemJ4ICsJr4NpsKk1jcoti+q/m7 zLUQ== 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 :arc-authentication-results; bh=XSp6Q1v1/gx7cjG8OqE3DYLw7nKGGu6Wqxa+SjucNcY=; b=ttQtMpiCnZHA63kPYvX3pEI3GauorpnVYgcqtxVDSnxVlNeDx0iwEPjptDNMEv/HpD 5s7phDEqeT8Kk9irtdXDJanJ+JeyHd1JDZHSxCpHvIIKNvuGWlYWaR5NimK7ySVvtZie Uilxrwixs//pDADneIX5LavQ+/GbrWCKUJOCw/ws6PsVYvN/BNOvxSy2HgKLfiXdH/Jf Pe3vMQbRcSRhSFrn7OLj3ox47nZWcoELBvEqOV7Tk+gzcfOMM8VSFd2sVHyBO7z4h73S wPAd9okkrgVjCVizllgCJYXHBwkLde4ubdXAwc0ng6+899GNiE9sWDS2ZiNX4ySHlwoX BBXw== ARC-Authentication-Results: i=1; mx.google.com; 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 b35-v6si15888460plh.36.2018.04.25.04.23.14; Wed, 25 Apr 2018 04:23:29 -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; 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 S1752908AbeDYLWP (ORCPT + 99 others); Wed, 25 Apr 2018 07:22:15 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51858 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753601AbeDYKj0 (ORCPT ); Wed, 25 Apr 2018 06:39:26 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 57856272; Wed, 25 Apr 2018 10:39:25 +0000 (UTC) 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 4.14 060/183] kconfig: Fix expr_free() E_NOT leak Date: Wed, 25 Apr 2018 12:34:40 +0200 Message-Id: <20180425103244.944360192@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425103242.532713678@linuxfoundation.org> References: <20180425103242.532713678@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 4.14-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 @@ -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: