From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E82B41F5DF for ; Mon, 24 Aug 2026 13:08:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787576896; cv=none; b=AVzzGyB/F7NSCOLLS8S3mCrCi+ZtHRZ+ADR4L/RisIt7baVzW8Q5ZXivhwVKIsG8EPr9cMlNcMnMEex/SvuAP1P+L4FGI3chdfEFkwpocVEDgNdtdVGE6niilOXNu96fVJtxEYlNjt60qb9uwx3+qp1+T9UnQsU37/MqrucTeZQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787576896; c=relaxed/simple; bh=B6bXHnVDRlMJYIYDWgJwAYz1CCE2u4qfSjjMykM0Ags=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=MWUqxPvf65NeSd2IkgVE7QFGccFifqnAup6aBJLePLDHoLdGW44TYcKVAuhHPbFF9gKRD31H9+PAmKk4kSNsXaMUz857/nF8A5mWdHVWUFx1fXuXbOP2RHhhIFqf2PbVfh5O1f4DK7/6ersODT6QTsNScbZWC3ia5KtU83chszo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.167.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-4b1bc2e44e0so7573765b6e.0 for ; Mon, 24 Aug 2026 06:08:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787576894; x=1788181694; h=content-type:to:from:subject:message-id:in-reply-to:date :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=+UAuuCQxVQ/JGNx3yXw+l6WEy27AW7MykBNRx2aFANI=; b=kZq0hPhcc1oKXtwrgAmnxOkSwj67Y1jvgWZ7HK/RwDfYDdNMZeBPad5YGIwXeR5PDq RhZ5D+xFeAvfkqnngpm2hiRkE4MYihKrr/FNSlUt3NQoNA+YS3Z/oCie+hRjjLE1aCG8 2a8hRIfyZFTv18eZssFge+hc3qY5ZkKQolA6IH9jN0qD1HKDUONsGqPktk7A5KxAP//P h3sDuGnUEUywxOCnaYWND/0kyM8iNBVji5pr5TuyoPqWm+19Tir8D4Vbnwb2Bz03H7JC JOLop/R6E6e2i+QFuhgq1uIy14bit8pVlIF6WtjGMh24ycL35DIQP/p0p+c92xIeST+K MQDQ== X-Gm-Message-State: AFuF++nGjwLSl4/6j1hEt5gnWkzufjZdAw4931ZtF1sq7B3UhHZ3fHsC fDpFcIeWN/tW97Jj5lwAx2p0BvJZwoR53dMQfLjUXXDWcbQdBqcRgZ8RN/fBaNPnoIn1UNMLCwC DeWJItgPpp+G05XEjTbr4BaizASXdFx52Tf199Y+d34lSaIRRTMGcEr7DsLs= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6808:d46:b0:4a3:26e5:cc02 with SMTP id 5614622812f47-4b2ef33a94amr24285747b6e.10.1787576893848; Mon, 24 Aug 2026 06:08:13 -0700 (PDT) Date: Mon, 24 Aug 2026 06:08:13 -0700 In-Reply-To: <6a8c13ee.91706f20.16b6e3.02d5.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a8c423d.dbb3a75c.7844.0003.GAE@google.com> Subject: Forwarded: [PATCH] eventfs: Initialize ei->children and ei->list in init_ei() From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] eventfs: Initialize ei->children and ei->list in init_ei() Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master eventfs_create_events_dir() allocates the eventfs_inode via alloc_root_ei(), but only calls INIT_LIST_HEAD() on ei->children and ei->list after the tracefs_get_inode() check. If that check fails, the code jumps to the fail label and calls cleanup_ei(), which calls free_ei(): WARN_ON_ONCE(!list_empty(&ei->children)); Since ei was allocated with kzalloc(), ei->children.next is NULL at this point, not a self-referencing pointer. list_empty() checks head->next == head, so it returns false on an uninitialized list head, triggering a false-positive WARN_ON_ONCE() even though the list was never used. eventfs_create_dir() has the same latent issue: alloc_ei() is called before INIT_LIST_HEAD(), leaving a window where an early failure path could hit cleanup_ei() on an uninitialized list head. Move the INIT_LIST_HEAD() calls into init_ei(), which is called by both alloc_ei() and alloc_root_ei() immediately after allocation. This guarantees every eventfs_inode has a valid, self-linked, empty children/list the moment it is allocated, regardless of which failure path runs afterward. Reported-by: syzbot+3ef80b4ed02226d04a06@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3ef80b4ed02226d04a06 Signed-off-by: Deepanshu Kartikey --- fs/tracefs/event_inode.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 604ba3e841d2..6e3513b13cfa 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -438,6 +438,8 @@ static inline struct eventfs_inode *init_ei(struct eventfs_inode *ei, const char if (!ei->name) return NULL; kref_init(&ei->kref); + INIT_LIST_HEAD(&ei->children); + INIT_LIST_HEAD(&ei->list); return ei; } @@ -729,8 +731,6 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode ei->entries = entries; ei->nr_entries = size; ei->data = data; - INIT_LIST_HEAD(&ei->children); - INIT_LIST_HEAD(&ei->list); scoped_guard(mutex, &eventfs_mutex) { if (!parent->is_freed) @@ -802,9 +802,6 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry ei->attr.uid = uid; ei->attr.gid = gid; - INIT_LIST_HEAD(&ei->children); - INIT_LIST_HEAD(&ei->list); - ti = get_tracefs(inode); ti->flags |= TRACEFS_EVENT_INODE; ti->private = ei; -- 2.34.1