Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1930206ybv; Fri, 14 Feb 2020 08:24:51 -0800 (PST) X-Google-Smtp-Source: APXvYqwLzRRtfqCAKJF9jpPA9uE4ZtJwTLBVW2ZpCVgPHM7sURytdBvufXY2v3IG0WTcqAyhIiYg X-Received: by 2002:a54:4e8d:: with SMTP id c13mr2407602oiy.27.1581697491091; Fri, 14 Feb 2020 08:24:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581697491; cv=none; d=google.com; s=arc-20160816; b=Ux/Ko3JNbehby5jKjVac8k+oKD3ucWk2XQ3KYfQpvRNTOUqdNBN9gH2C7PamziLAxI YXnoHzlUvJYKC/vCdM7wZdIfuTkdFUMu5trDJ/oKeMQWNRy9GfkhcM5WW9QQncSoVeM9 H71JCxjCniS0vMU5spto/OpHj27amh0sWLBmdpiwYq2ncqEgtUk4vHI1XPbR43SC6ge9 0l1XtnrRv/5ZtQa4+Ux2k/QHEdCPzyDhTbvVvtr64oK09sMVnFErOOZHzJh8fjN96mXK rFr7tMoKKNMy8I8Y6yW+Xbaz0hXulL75fbEzro/OtKJWzOQgrJ7zQTuOodFDSpva0fHN wHMg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9vSDeJSuIDMMv2H2Jwex0lggiDCt1+LUSUx8Z2+Ir5I=; b=s9WdCK/SDNePZhwXFlGLNp2HnPlMkr2Vhaqh+e9RKrvVdKv9AgtB125fLtBKhJlz4l nEEYFDG+5LXVlLexlaVitGoo97d7VVQGEjVPvj6zWXqMqX0Q606gIxm87VWFEYLK4T3A kDsufGLY6rTc+ah3u5qCdGovmvKTG9h8/4kBy/nl/CH81VO1HbVpCdIZPHoGRygBRK6U OGL/Fgua/z/LdrDu3XyCGuCY/9YdRLmvJ92Mlstgz2bWXGpz4HmF9KMNewe3yJoL58QR yZQtIrWNQ7j3kvwstUGCDvFIB0p1KQ65pLVx1uK8qvQebwiXqHk4C2Pzj96KiD9CI6yo e9Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=K2y0MyfL; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u25si2715862oic.160.2020.02.14.08.24.39; Fri, 14 Feb 2020 08:24:51 -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=K2y0MyfL; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405659AbgBNQXb (ORCPT + 99 others); Fri, 14 Feb 2020 11:23:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:56876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393126AbgBNQVz (ORCPT ); Fri, 14 Feb 2020 11:21:55 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E259E24696; Fri, 14 Feb 2020 16:21:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697314; bh=LuseXJ4uPadvIGWiSNiwoqxMT0xlXCZRNzgYsn14qas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K2y0MyfLA93BQXdZmr3LnYQ4R87frOJNF83EXM85jv6xiMFyMy89uDhZpHqoR/tto a892QwTKT2pu3oeKqhNHUVBTeecIjZy6qi8RvRQc5X3RUeHmO6U+okyD3XQB2h1AEM ++p7qGRdGQbHyxwnTXzIYYLDGbJ4OI71UBNlRUXA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Luis Henriques , Steven Rostedt , Sasha Levin Subject: [PATCH AUTOSEL 4.9 025/141] tracing: Fix tracing_stat return values in error handling paths Date: Fri, 14 Feb 2020 11:19:25 -0500 Message-Id: <20200214162122.19794-25-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 413ff108fbd05..bc97b10e56ccc 100644 --- a/kernel/trace/trace_stat.c +++ b/kernel/trace/trace_stat.c @@ -277,18 +277,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