From patchwork Wed Aug 29 12:17:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Motai.Hirotaka@aj.MitsubishiElectric.co.jp" X-Patchwork-Id: 10580195 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 23A1C174A for ; Wed, 29 Aug 2018 12:40:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13C792AFFD for ; Wed, 29 Aug 2018 12:40:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0762F2AFF8; Wed, 29 Aug 2018 12:40:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A180C2AFF8 for ; Wed, 29 Aug 2018 12:40:38 +0000 (UTC) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 7B12CD4A; Wed, 29 Aug 2018 12:36:45 +0000 (UTC) X-Original-To: ltsi-dev@lists.linuxfoundation.org Delivered-To: ltsi-dev@mail.linuxfoundation.org Received: from smtp2.linuxfoundation.org (smtp2.linux-foundation.org [172.17.192.36]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 14E0ACB8 for ; Wed, 29 Aug 2018 12:36:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx05.melco.co.jp (mx05.melco.co.jp [192.218.140.145]) by smtp2.linuxfoundation.org (Postfix) with ESMTPS id 1CD251DD12 for ; Wed, 29 Aug 2018 12:36:39 +0000 (UTC) Received: from mr05.melco.co.jp (mr05 [133.141.98.165]) by mx05.melco.co.jp (Postfix) with ESMTP id 986AC3A3269 for ; Wed, 29 Aug 2018 21:18:08 +0900 (JST) Received: from mr05.melco.co.jp (unknown [127.0.0.1]) by mr05.imss (Postfix) with ESMTP id 420l5D42sQzRkCl for ; Wed, 29 Aug 2018 21:18:08 +0900 (JST) Received: from mf04_second.melco.co.jp (unknown [192.168.20.184]) by mr05.melco.co.jp (Postfix) with ESMTP id 420l5D3lFqzRkC3 for ; Wed, 29 Aug 2018 21:18:08 +0900 (JST) Received: from mf04.melco.co.jp (unknown [133.141.98.184]) by mf04_second.melco.co.jp (Postfix) with ESMTP id 420l5D3lf3zRkCn for ; Wed, 29 Aug 2018 21:18:08 +0900 (JST) Received: from JPN01-TY1-obe.outbound.protection.outlook.com (unknown [23.103.139.178]) by mf04.melco.co.jp (Postfix) with ESMTP id 420l5D3X12zRkCw for ; Wed, 29 Aug 2018 21:18:08 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mitsubishielectricgroup.onmicrosoft.com; s=selector1-mitsubishielectricgroup-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZIJnO9w9MqeYCW6wpfkYjZ5ifFCJpatIsJP7znscXJI=; b=ayfIVOzSk/DeduC1k+fSCLYGyEMLa1cdioh5pm/Je/EFyuD7K/6lkyRpcgwbP8lhXOpFGEVu/M34TB21aAFL2U+Z9e46i3NNhuccxq2KkeiMeGqwS+OocZNSVvtQCKRWsdTxpYRXO8J9JUXJbly17dMIDkBSIIy4ZItoyL9rbaE= Received: from TY1PR01MB1692.jpnprd01.prod.outlook.com (52.133.160.145) by TY1PR01MB0762.jpnprd01.prod.outlook.com (10.167.158.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.15; Wed, 29 Aug 2018 12:18:07 +0000 Received: from TY1PR01MB1692.jpnprd01.prod.outlook.com ([fe80::d04e:e6f6:c782:22fa]) by TY1PR01MB1692.jpnprd01.prod.outlook.com ([fe80::d04e:e6f6:c782:22fa%2]) with mapi id 15.20.1080.015; Wed, 29 Aug 2018 12:18:07 +0000 From: "Motai.Hirotaka@aj.MitsubishiElectric.co.jp" To: "ltsi-dev@lists.linuxfoundation.org" Thread-Topic: [LTSI-dev] [PATCH 43/54] tracing: Fix a potential NULL dereference Thread-Index: AdQ/jOXBCGrOtl8KRUejCEas+WT3Sw== Date: Wed, 29 Aug 2018 12:17:11 +0000 Deferred-Delivery: Wed, 29 Aug 2018 12:15:00 +0000 Message-ID: Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-melpop: 1 authentication-results: spf=none (sender IP is ) smtp.mailfrom=Motai.Hirotaka@aj.MitsubishiElectric.co.jp; x-originating-ip: [153.231.200.201] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TY1PR01MB0762; 6:IgiKSh1taV6jliLf0MbKo8Yw0eDgwkHd0VyydN9BrotmXkgb++HGNxin9mgWsM5WKLgPPJORhG78/mGKduhOH1fkbyIHUKAKMUPuaW5dol80Dj3nICPDBpYzj6jOa86j2oe+YwbtbmUjE1h0WCDWubO96AH/Uo0e+ogOifq2Kn2q0W8bez66V7naf2YdzzgJVWDcONhOHlncLFNJP++/hO7RusVoPQIl5vm1M2nolOaYDcMNY0XNeDb7jj5BWu7tfV9cGbmFOMI7It5VCcI305va0xgkTbpP8tqLRngl2UOhSIHb2/f3yG7hzPLccP7ezSSRUdhdMQ+/B7QFUJS6xQu4eABRNrwVTvJSJ/0XrfU4dIzEmDnutzUOj5u+v01PIURZibbmve24wvDwuwpy5AHCTDOhEjVMT/cE8X59oQZapdFv5IyTUBv5p8m4KLrCgn6BEYj+4mJ1E+1Mby6yqQ==; 5:jCoMXoZTT6D6ci+GimKgjqV+ughG8sm8EGgrO9Q2j3sVNapJmcRXiaCV9Wgh7CceJiO+gsZwmsYzhk+2OtLQbrOzTFOWFuY15OHX15ZKGSV7ntxCjy9K1shu1PGEJBxPnD0v7dB0OjGnbV6wbcD7MZLWbzB1Q6GD/S0Aqoc5Se4=; 7:DjkW+r7qRizrN2Bcs5ZgF+FEcq/s9fnRy+dULm1EPWhr8KuUc38eWSoPdExMzhOz5yVh3S6P6NCLG7UYV2wym4M9VJrozjQHnUFwkNO59KUa2Ec5wYJeQRKejfsv2v/SPXz2BQyoQSbupJv6UQ9UJAdOD4PwxvV1txzkec8pUwuHDpbrAPYCeDnh9vjMqFSIDZLDJUugFNgGbaW95Tb0t71M50FOqhXrjEkVJ2irdTNaWqB2ngT/7WS/grtoJGhl x-ms-office365-filtering-correlation-id: cbe52efd-6d75-4f98-c3f2-08d60da97ab0 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:TY1PR01MB0762; x-ms-traffictypediagnostic: TY1PR01MB0762: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(42068640409301)(146099531331640)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3231311)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(201708071742011)(7699016); SRVR:TY1PR01MB0762; BCL:0; PCL:0; RULEID:; SRVR:TY1PR01MB0762; x-forefront-prvs: 077929D941 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(346002)(376002)(136003)(366004)(199004)(189003)(7696005)(186003)(72206003)(6116002)(478600001)(3846002)(1857600001)(256004)(74482002)(5250100002)(5660300001)(966005)(2501003)(99286004)(2900100001)(8936002)(53936002)(68736007)(33656002)(9686003)(2906002)(97736004)(6306002)(26005)(476003)(7736002)(305945005)(74316002)(6666003)(316002)(14454004)(486006)(55016002)(81166006)(5640700003)(66066001)(8676002)(86362001)(6436002)(2351001)(6506007)(106356001)(25786009)(6916009)(105586002)(102836004)(575784001)(81156014); DIR:OUT; SFP:1102; SCL:1; SRVR:TY1PR01MB0762; H:TY1PR01MB1692.jpnprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:0; MX:1; received-spf: None (protection.outlook.com: aj.MitsubishiElectric.co.jp does not designate permitted sender hosts) x-microsoft-antispam-message-info: 4POe659FW/P8QzUzKWpIMj0H/rsfu20QJfHWUfO3hOQsWOSjRZ/J1K616KT0xlWiVq8ptVog8DQryMo3gCGJEg2wBMijyo5X/wQmlEYgaD2sDtPL3MuhBjzeJlgL3FMi2sT8ckYxv2ZRJEs3kohiBSyrIDyQuJN6eqMdGfuVDE7xXQFmaU1LhM5jLoSwt0hJYCgvt2i4A2gEc2LbDK8MCbyeypICRENbROVa4cQQwv9LvX+tshK2RGooChB7SM+886cc6niPZyCrjfrel6I0iij5rFajZ/T6z+1tn0Eg82T3JiFw9B3BByKvCHfAlWQ2iuIrW/KcD+qDRROmtueuqDyeYUi91Mw+egEv/e3cNsU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: aj.MitsubishiElectric.co.jp X-MS-Exchange-CrossTenant-Network-Message-Id: cbe52efd-6d75-4f98-c3f2-08d60da97ab0 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2018 12:17:22.6467 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c5a75b62-4bff-4c96-a720-6621ce9978e5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1PR01MB0762 Subject: [LTSI-dev] [PATCH 43/54] tracing: Fix a potential NULL dereference X-BeenThere: ltsi-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "A list to discuss patches, development, and other things related to the LTSI project" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ltsi-dev-bounces@lists.linuxfoundation.org Errors-To: ltsi-dev-bounces@lists.linuxfoundation.org X-Virus-Scanned: ClamAV using ClamSMTP We forgot to set the error code on this path so we return ERR_PTR(0) which is NULL. It results in a NULL dereference in the caller. Link: http://lkml.kernel.org/r/20180323113735.GC28518@mwanda Fixes: 100719dcef44 ("tracing: Add simple expression support to hist triggers") Acked-by: Tom Zanussi Signed-off-by: Dan Carpenter Signed-off-by: Steven Rostedt (VMware) (cherry picked from commit 5e4cf2bf6d1c198a90ccc0df5ffd8e0d4ea36b48) Signed-off-by: Hirotaka MOTAI --- kernel/trace/trace_events_hist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 4f027642..a02bc09d 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -2771,16 +2771,17 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, switch (field_op) { case FIELD_OP_MINUS: expr->fn = hist_field_minus; break; case FIELD_OP_PLUS: expr->fn = hist_field_plus; break; default: + ret = -EINVAL; goto free; } return expr; free: destroy_hist_field(operand1, 0); destroy_hist_field(operand2, 0); destroy_hist_field(expr, 0);