From patchwork Tue Nov 26 17:36:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Connor Kuehl X-Patchwork-Id: 1201137 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47Mrgd2BZKz9sP3; Wed, 27 Nov 2019 04:37:01 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1iZela-0002UA-Ti; Tue, 26 Nov 2019 17:36:46 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iZelY-0002Ti-Ak for kernel-team@lists.ubuntu.com; Tue, 26 Nov 2019 17:36:44 +0000 Received: from mail-pf1-f200.google.com ([209.85.210.200]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iZelY-0004Xj-1v for kernel-team@lists.ubuntu.com; Tue, 26 Nov 2019 17:36:44 +0000 Received: by mail-pf1-f200.google.com with SMTP id s131so7063327pfs.21 for ; Tue, 26 Nov 2019 09:36:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OEFckA+3do024Z6skUKKLSXch7cxLuxfJNAKyF4wxAY=; b=U8e1ovugEA7y0IKdGy4y70VFsngid4uH5dIfzT74QwQwAb6VQSnYp/0STiNmS0Gwph MjFn6Kp6ZYNAsm0+P8g7rnKhlZsdp1IWotr2oD7e+NhPW9pj6bk1MBcGEF1hOha/ib6V LunYtsvhop4l48IWZfIRaSYwpAOx4uyvS3k46LiJiVQc68SClQDCFlg/im7TycDX9lyv GIvVoyhPhZIfsDVKy6wDjjyCrrJ9WwPl/8HsHX5Sp4dnu1T8uGuzO95NOAUXteb1qKGm H1ctii5Xn2sc7Lmlh7ZQ1b4FP7QxdTXq0UYdyPcaz7EzF5Co44ysc4BoRFfpCsmACGLI o3kQ== X-Gm-Message-State: APjAAAU9jocvCp6iWXlq9ELGFC9G4ruA5YiMkAPEZI3PC8pdMAiBU0PW ypm8BfRmoXjEPCyazr0WW2jjfbzh+3HPzTm7TNgT4Z7BNzoh00S/JGp+CHkcGmxuphM8k2rB4VU N1D0kx+I/6Uw/ooFpCTGVzgXb64/1Ys+VKzyxhyRzRg== X-Received: by 2002:a17:90a:a58b:: with SMTP id b11mr304507pjq.46.1574789802467; Tue, 26 Nov 2019 09:36:42 -0800 (PST) X-Google-Smtp-Source: APXvYqx3Ld12Qq61obBYecr9EF5ZC9h0iAvO888EaYXpmpbDyE8DxRFy0mFVDtUDarB9f1gsDuNovg== X-Received: by 2002:a17:90a:a58b:: with SMTP id b11mr304475pjq.46.1574789802274; Tue, 26 Nov 2019 09:36:42 -0800 (PST) Received: from localhost.localdomain (c-71-63-171-240.hsd1.or.comcast.net. [71.63.171.240]) by smtp.gmail.com with ESMTPSA id u7sm12904876pfh.84.2019.11.26.09.36.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 09:36:41 -0800 (PST) From: Connor Kuehl To: kernel-team@lists.ubuntu.com Subject: [D/E/F][SRU][PATCH] tracing: Have error path in predicate_parse() free its allocated memory Date: Tue, 26 Nov 2019 09:36:38 -0800 Message-Id: <20191126173638.5633-2-connor.kuehl@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191126173638.5633-1-connor.kuehl@canonical.com> References: <20191126173638.5633-1-connor.kuehl@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Navid Emamdoost CVE-2019-19072 In predicate_parse, there is an error path that is not going to out_free instead it returns directly which leads to a memory leak. Link: http://lkml.kernel.org/r/20190920225800.3870-1-navid.emamdoost@gmail.com Signed-off-by: Navid Emamdoost Signed-off-by: Steven Rostedt (VMware) (cherry picked from commit 96c5c6e6a5b6db592acae039fed54b5c8844cd35) Signed-off-by: Connor Kuehl --- kernel/trace/trace_events_filter.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index c773b8fb270c..c9a74f82b14a 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c @@ -452,8 +452,10 @@ predicate_parse(const char *str, int nr_parens, int nr_preds, switch (*next) { case '(': /* #2 */ - if (top - op_stack > nr_parens) - return ERR_PTR(-EINVAL); + if (top - op_stack > nr_parens) { + ret = -EINVAL; + goto out_free; + } *(++top) = invert; continue; case '!': /* #3 */