Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1614562ybv; Fri, 21 Feb 2020 00:19:05 -0800 (PST) X-Google-Smtp-Source: APXvYqyt6Kh9qj3oSbltjXVj72dezCqoF6oJNMXZ3/uAOVv7MFhH3FMpE1zDN3Ci4F9npCVKn8T+ X-Received: by 2002:aca:cd46:: with SMTP id d67mr1013948oig.156.1582273145085; Fri, 21 Feb 2020 00:19:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582273145; cv=none; d=google.com; s=arc-20160816; b=Ns+F68CbwAcvpeHnOkUYVglnw67GB6QhVe6GcIO2xnkyXIPMbXJhVnEDFLLqjO5e3b ysyyXK/O4ROVpuXp2KkZea2wSbIIfy5L4OJRaIUVyocU6IW20j3j4XXffS6Z/Z9kfnw8 T8Bb5hfj6fYKPIvIyxxZ8vdm5OmL3jUNMMma5xDQyvbInFTehO61lsNgQKh+77vCq5Yy 1k0EsQYoXEplXNjfTMo1TIv5SikvhKQikHfcwSCIs1GU457PiGfKSFF54n8UcImmW+YA CMnPASDb1RMgcWKdlA8WBSAcgW5gkoBcEzKVtVH0T/z+YSwPSP1y96WxRANWhdkp0d8X kRjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rmLICndGoalNQ4xuwbPXFsOvr5lof6rGjBWNKSdLUbo=; b=Sh2YTSZLPDcY0DdZDT0pVOPjkAve5i3vlb+nHyTHgFMZ2kGPtu0viJruWT0mRrueHR GiYiWUsV9Bf94mqs3wHirL8Rbye6DhNqFJEdmiidDGn2yvQpR9km5e18Zko6BKRzU0Yt BZKJwSC/Ecw8uspFI8z6mVTWTPL066mopo44sRXRwgc6dIPC3fYVXjh0V+Yxp0krlqvs 4Kd/Ca5MgrrJxxL4KspOw5B5fDKNTiA1wE3arL2uLP8jce0qM4Gfd5MV92uhsz0TUUPm XQafk5eS23VVJYNeG0LeULSFTPTWu0gckTCBP0FBwC71epKwmtrSOymG1ey9ojukJqfS rdYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VEQ8ATO1; 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 l84si459039oig.5.2020.02.21.00.18.53; Fri, 21 Feb 2020 00:19:05 -0800 (PST) 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=@kernel.org header.s=default header.b=VEQ8ATO1; 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 S1729254AbgBUISO (ORCPT + 99 others); Fri, 21 Feb 2020 03:18:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:55948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387782AbgBUISJ (ORCPT ); Fri, 21 Feb 2020 03:18:09 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4748424682; Fri, 21 Feb 2020 08:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582273088; bh=MsONPWTNfPo6V0X4S3Ypn68YP2qKHWF1siRbP0V/Czo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VEQ8ATO1DeQ6LLjtjFL7LFlL5fcGLJASVb72nk/fdu8vE56YfswGIDlhG+zMy5zJg bYTsSy37bBI5ZxELUiFrHaEvnVWyhFu1xoqsUJ2DMR50bS/0SQquct7BsDE5DTwGzN 0qTNUB8lE9faOzi28Dgrq7BkG7dOJ5xXNnZqhyR8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luis Henriques , "Steven Rostedt (VMware)" , Sasha Levin Subject: [PATCH 4.19 041/191] tracing: Fix tracing_stat return values in error handling paths Date: Fri, 21 Feb 2020 08:40:14 +0100 Message-Id: <20200221072256.492252904@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072250.732482588@linuxfoundation.org> References: <20200221072250.732482588@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luis Henriques [ Upstream commit afccc00f75bbbee4e4ae833a96c2d29a7259c693 ] tracing_stat_init() was always returning '0', even on the error paths. It now returns -ENODEV if tracing_init_dentry() fails or -ENOMEM if it fails to created the 'trace_stat' debugfs directory. Link: http://lkml.kernel.org/r/1410299381-20108-1-git-send-email-luis.henriques@canonical.com Fixes: ed6f1c996bfe4 ("tracing: Check return value of tracing_init_dentry()") Signed-off-by: Luis Henriques [ Pulled from the archeological digging of my INBOX ] Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Sasha Levin --- kernel/trace/trace_stat.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/trace/trace_stat.c b/kernel/trace/trace_stat.c index 75bf1bcb4a8a5..bf68af63538b4 100644 --- a/kernel/trace/trace_stat.c +++ b/kernel/trace/trace_stat.c @@ -278,18 +278,22 @@ static int tracing_stat_init(void) d_tracing = tracing_init_dentry(); if (IS_ERR(d_tracing)) - return 0; + return -ENODEV; stat_dir = tracefs_create_dir("trace_stat", d_tracing); - if (!stat_dir) + if (!stat_dir) { pr_warn("Could not create tracefs 'trace_stat' entry\n"); + return -ENOMEM; + } return 0; } static int init_stat_file(struct stat_session *session) { - if (!stat_dir && tracing_stat_init()) - return -ENODEV; + int ret; + + if (!stat_dir && (ret = tracing_stat_init())) + return ret; session->file = tracefs_create_file(session->ts->name, 0644, stat_dir, -- 2.20.1