From patchwork Wed Jan 31 18:49:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 194901 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2094800dyb; Wed, 31 Jan 2024 10:56:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKTIuI8pNg9dZTGz1QGA0WY4A4oHJn2TIa1Zz/4b0l4nv7iU/isTrGIlH+OgiYU/ekZoHt X-Received: by 2002:aa7:91ca:0:b0:6de:1b57:ca8c with SMTP id z10-20020aa791ca000000b006de1b57ca8cmr2434133pfa.23.1706727415737; Wed, 31 Jan 2024 10:56:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706727415; cv=pass; d=google.com; s=arc-20160816; b=QQTruNgDyKH5O1bwFkAe5j3w9zMwqd0NxC7h5Pm8san0/efvLpJKZaNTKmZCw5BOv2 EdNP3TqMBWqraH8ysMkDOPEHSyGMSXCmjZZAvz2l/OClsSi1/ZtJhb5lj708nSqUznOR 1yzHiQcNJnROmIE7neX0F/DEH4svpDkz3DYkp6Hfjc3iYHa9h40yIDutVmYMEXOliRkt bQSSQGBdTL8Uk8sgpY9ip8neVZFUuj5+9MWksBlTdKmuJWe192UxoNWf0d7UmgkI1vVD /RrAgXRmPd0dTMkzl1euCM948z7HzevjhGfWFoAvE2augdbUv/tZTb6XTiPDoWbU3TWb tMCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=s4r0o6G8SaT+rQppo9CI/mZyE+VqCeHQrA5gsQDbtho=; fh=5zt4BK7uRnrjTfz1VEGqL9FSJx1MNzRoJg2nhzVqnxw=; b=Jamk2kPLNb4mPWxyKhJ8h6mPy64R0W848/XAtjMHOjWEj6BaRtkRZ37YsKUu1zb1It nv9cyQ7OgyZENg1f2M0P6zKN4Ve5vTibDpNkOaGjzKh1ioFbdt9RX0xX/c1tOApRS6wa nZJVwTiA9tplQVQXvfNg1xX7DGUdlqreO3godGelEaB0RmyLHfPL4KmfaZHAUHP2KiJe cO29tG8DRm/+7O28CmV2t2Xvxfa5Z4Bk/PHaHp/Usecz/uLWkLwWXV4upuTCYfJkDeoz D31h6Yiq95mBfW8xn8p90k15U0brF3s+stzd2EiLESKBypKrhhgTKoAtV25lG0ibfN80 B5fA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-46990-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46990-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUax/URML9HPR+0v6DThp23FfHDnayLjW6NmMCpYp7Kmp+u55e6B0TH+/OXNQN6h+3fHEjwZn9XnXDPFYkIy/5whQPA5Q== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a14-20020a056a000c8e00b006de212f1c59si7185361pfv.101.2024.01.31.10.56.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 10:56:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46990-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-46990-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46990-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7D5762851DF for ; Wed, 31 Jan 2024 18:56:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1AA9E13541D; Wed, 31 Jan 2024 18:55:00 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 126083A8FE; Wed, 31 Jan 2024 18:54:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706727298; cv=none; b=QNyL46sDnBnrpgal219thiF4Hw4JOvSzIMwBjGrnEAmA2VHnjHQe05JrqA6druQj6Eh/YRbOmkZhUvhZcw8r34DGokCsQ/rAdveXpbAkzSasqOJdfb0CdM0CB/RCfyFMXVElS7rJH6PjLOFEYQScxJUn2C40TdoKb3ywpanh9Mo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706727298; c=relaxed/simple; bh=7Rdww8PD/OZDuJxNvZnG5j/I+jvbRavpqIHcKsYavJQ=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=O8KbXwxcDuDNVuzyThFh293AFGLq0ovmBcfZ1iFkezRYTECvHntNpB//rASDyXktw+I//quNIEFhjG1fzLTeXvupAIZOsoulwnPPJ/yjmw5mIFtP+wa9gG5XZLJEe/yi5WjjHO9teI0/tzszT0iCOIp9DilZtnFeTtzQJtEFRTc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3D7AC433A6; Wed, 31 Jan 2024 18:54:57 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rVFjs-000000055QM-2apb; Wed, 31 Jan 2024 13:55:12 -0500 Message-ID: <20240131185512.478449628@goodmis.org> User-Agent: quilt/0.67 Date: Wed, 31 Jan 2024 13:49:20 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Christian Brauner , Al Viro , Ajay Kaher , Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot Subject: [PATCH v2 2/7] eventfs: Initialize the tracefs inode properly References: <20240131184918.945345370@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789633406682114754 X-GMAIL-MSGID: 1789633406682114754 From: Linus Torvalds The tracefs-specific fields in the inode were not initialized before the inode was exposed to others through the dentry with 'd_instantiate()'. Move the field initializations up to before the d_instantiate. Cc: stable@vger.kernel.org Fixes: 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202401291043.e62e89dc-oliver.sang@intel.com Signed-off-by: Linus Torvalds Signed-off-by: Steven Rostedt (Google) --- Changes since v1: https://lore.kernel.org/linux-trace-kernel/20240130190355.11486-2-torvalds@linux-foundation.org - Since another patch zeroed out the entire tracefs_inode, there's no need to initialize any of its fields to NULL. fs/tracefs/event_inode.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 1c3dd0ad4660..824b1811e342 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -370,6 +370,8 @@ static struct dentry *create_dir(struct eventfs_inode *ei, struct dentry *parent ti = get_tracefs(inode); ti->flags |= TRACEFS_EVENT_INODE; + /* Only directories have ti->private set to an ei, not files */ + ti->private = ei; inc_nlink(inode); d_instantiate(dentry, inode); @@ -515,7 +517,6 @@ create_file_dentry(struct eventfs_inode *ei, int idx, static void eventfs_post_create_dir(struct eventfs_inode *ei) { struct eventfs_inode *ei_child; - struct tracefs_inode *ti; lockdep_assert_held(&eventfs_mutex); @@ -525,9 +526,6 @@ static void eventfs_post_create_dir(struct eventfs_inode *ei) srcu_read_lock_held(&eventfs_srcu)) { ei_child->d_parent = ei->dentry; } - - ti = get_tracefs(ei->dentry->d_inode); - ti->private = ei; } /**