Received: by 10.213.65.68 with SMTP id h4csp281101imn; Fri, 23 Mar 2018 04:38:58 -0700 (PDT) X-Google-Smtp-Source: AG47ELsDyIJEKqvXM0Y92HjUxyd+d25S3qoFSW/to/n1hWQOtjmwYOlzRAs6uKFSnLtuC8m2Io+m X-Received: by 2002:a17:902:30f:: with SMTP id 15-v6mr28239795pld.365.1521805138084; Fri, 23 Mar 2018 04:38:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521805138; cv=none; d=google.com; s=arc-20160816; b=wrGfuYgaUcNWsyaXrCxrTqGSJPklkM+lvd2/eQ7ZTDLsX+H6P9hZPnUp3ThJkEesqh zO5VWhgk9ZEpFpvGITKt72jGWb/MdiSW2qEVbJUqOg4pP5UouHbYxc2u6xaRCZHFJw/o ZQAE/SLfZ08LPrrWnEjbDjCidYQ9xyOMz/In+sHCj1IEY2cpqVd+3NZD/QObnXFCeSJw I/Jit6TZBmdcfvN/o0PooYVBq+bRLDZTtUnIHF5MYWkC9fshJeSkAm3uBxoYfyMjMWcW 3XFEdNGHXBP73kRNNAGkint9Ykqu7Fxx3aFuI6gNJ3mPZiI9MZfs1iH3KRKlGHac8WUC IQvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=0ZoI/7ETlarSWXC++3sRkYTXeUP5HvhaEyB8wx/l1n4=; b=B9IN5giiJB/iURNs2xuxt/xna0DcE1Wro0xGGqZX/LM2wyD4YG9m/dsELnPh+hrIZk XrCkStCDo5Np9jZA001pk/JbbBRodafjUHb/DIXp4tvEjtF7w8KDeDxLfHCEozJsSf+T 33WhKkF7zfZ1ffdCs7UKu6IpldFwfDaLcfOVgvcIPMtkg1UMoK402HPiEZ6RDdA4C3IM RPLnI4eVb94BWiykolYJdRBJS4xfIcRXWmDGPSA0n4WlKe5Az9Zv7HMfscbJhHRfTXGT VzM6VkYPJYdGjei+LNP5GrQXnp6CeLjZwgKzVRY9KehwzxFOm9pA+PszpN4ABR75jHFn N1xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=RYB2sqvz; 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=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k22-v6si8128437pls.182.2018.03.23.04.38.43; Fri, 23 Mar 2018 04:38:58 -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=@oracle.com header.s=corp-2017-10-26 header.b=RYB2sqvz; 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=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754926AbeCWLh4 (ORCPT + 99 others); Fri, 23 Mar 2018 07:37:56 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:35440 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754813AbeCWLhx (ORCPT ); Fri, 23 Mar 2018 07:37:53 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2NBO2V3082452; Fri, 23 Mar 2018 11:37:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2017-10-26; bh=0ZoI/7ETlarSWXC++3sRkYTXeUP5HvhaEyB8wx/l1n4=; b=RYB2sqvzYNjfa+fsAkgprq+spbHEWdKpASbOUGRp+p0H2qGOLKU+gEz99ScTJMdCGe67 yQ8Km6jm2JD4QZrT/E2eirPCw1zeHRo0OGbwGBTCxZLa0dJyeDx3fgt1mKPvo7CoKjDd hAe2UhsXpoUxb6rlesYFj9c4CGR1CUWZHSo+n51Svs3ul8u/olN6jY4YI8qN6XGFY6hU HJ35dGmjDzXUDQtbHMv/Cp4GaszJfCvDHWd+t6Jg22VhulXldgy2OjMDmSWqhMPubhYI Nk6IJw/UIwCLBgfUftk5X1Y1+fhnASZyVZAKLqCAqboENpNowN9q+mq40jjvY2LlGt3J nw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2gw0nvg3he-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Mar 2018 11:37:44 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2NBbh51003978 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Mar 2018 11:37:44 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w2NBbhnL004489; Fri, 23 Mar 2018 11:37:43 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 23 Mar 2018 04:37:42 -0700 Date: Fri, 23 Mar 2018 14:37:36 +0300 From: Dan Carpenter To: Steven Rostedt , Tom Zanussi Cc: Ingo Molnar , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] tracing: Fix a potential NULL dereference Message-ID: <20180323113735.GC28518@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8840 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=990 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803200127 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Fixes: 100719dcef44 ("tracing: Add simple expression support to hist triggers") Signed-off-by: Dan Carpenter diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 4f027642ceef..a02bc09d765a 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -2776,6 +2776,7 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, expr->fn = hist_field_plus; break; default: + ret = -EINVAL; goto free; }