From patchwork Sun Dec 10 21:35:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beau Belgrave X-Patchwork-Id: 176405 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6705818vqy; Sun, 10 Dec 2023 13:36:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQvRu+DgqL2QfAOXhJIDAtuxtWLmUMaubMhOpqDaMoMAy/ypURrk0xUkgz7lWSBVyNvlmf X-Received: by 2002:a05:6808:6493:b0:3ba:d81:8408 with SMTP id fh19-20020a056808649300b003ba0d818408mr416561oib.41.1702244181456; Sun, 10 Dec 2023 13:36:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702244181; cv=none; d=google.com; s=arc-20160816; b=GIbV7Xwt8iqNzCT/zJACJwAy6qpN3x/098YQG/mR8qeq9oZP8XFtvbVY0miHTqh2t/ mIK6qpszx8/HxzcWf8ls6ZWiAvTeJmmD01tRsX2ptwv0cSJjUCsYpqAL3s9d8lyLWllr RzSuiBcVunIhAklaD4W9rwLoh4cu4YS0FFAv2p4jZ8C2wH5jcvKgZhcvHlrJK9EjYQWV AtXkpCx63uBp8Yjjj85aMZw3lU0z1pSP30DmRVqcasdtj2dhP0Kf28g31OSNpxYtPE3c kLc78dszWgbEBq6Z/gy9+X2h3LqKtEGtUgpA8Drs6A/rIByta22a69sYm7TyP8s1Ylxu NoIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=AwLPxkWSQ+xItqIkFFnflTbsJwcL70eHM305+He6/Pg=; fh=lCtvpAD9uJg/iG8of2nCmZf98nVN3tlGtCzUkxegJjU=; b=qUAGFXHOxg0+/MHXdc6VzTDZ2kkcvmTOfZkBvC/gsHPqwV8r7pgPpO8y63hXJQi+WN FvYst70LY4Ar1iyrDIOS1JNSFuHjCCW9tQ8Eq7dzpZ/GT+GlgA+ceqfzUflAPVDqG+zs 41SEmbmlFUs2JxxEpC9qL3hJplHW+TsqniDKGaVL9RuegYtRDnxM7SBFKeZ4nGoeCf9q WRWcVM98GKYWkaKGMh3GuhfZYOsUPZy5BZlW/ZeQ0YY+xQyEhqDeWqNmE+D1LFZur+FB iUPEMObw8cx8iGQ6FnPYnKrLsqU//0apncJhjPTFwuvlTTHfuplSEHPdlXfeBnh+h/kY PWUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Q0yqQ06D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id t9-20020a63eb09000000b005bd04d27b69si4936806pgh.725.2023.12.10.13.36.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 13:36:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Q0yqQ06D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 95C028067B41; Sun, 10 Dec 2023 13:36:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232095AbjLJVfe (ORCPT + 99 others); Sun, 10 Dec 2023 16:35:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjLJVfd (ORCPT ); Sun, 10 Dec 2023 16:35:33 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D7EE7CF; Sun, 10 Dec 2023 13:35:39 -0800 (PST) Received: from localhost.localdomain (unknown [4.155.48.117]) by linux.microsoft.com (Postfix) with ESMTPSA id 0B1F620B74C0; Sun, 10 Dec 2023 13:35:39 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0B1F620B74C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1702244139; bh=AwLPxkWSQ+xItqIkFFnflTbsJwcL70eHM305+He6/Pg=; h=From:To:Cc:Subject:Date:From; b=Q0yqQ06DL6j6eJXGiMYqLMRzH0Z35EwyGtwfYeQo39pIavtQQswP9U9W+Y2C4mnK5 4DOQl4iBwB/Fdjj1Twp+REAOorZvSpve6dVXFD+7rnWCyPFshu2X+bO0PC3bT60Jod +u8XHr4jdJl+or4ylxmDlOSB7qLan3taIGygsXug= From: Beau Belgrave To: rostedt@goodmis.org Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH] eventfs: Fix events beyond NAME_MAX blocking tasks Date: Sun, 10 Dec 2023 21:35:34 +0000 Message-Id: <20231210213534.497-1-beaub@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sun, 10 Dec 2023 13:36:18 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784932394481761334 X-GMAIL-MSGID: 1784932394481761334 Eventfs uses simple_lookup(), however, it will fail if the name of the entry is beyond NAME_MAX length. When this error is encountered, eventfs still tries to create dentries instead of skipping the dentry creation. When the dentry is attempted to be created in this state d_wait_lookup() will loop forever, waiting for the lookup to be removed. Fix eventfs to return the error in simple_lookup() back to the caller instead of continuing to try to create the dentry. Fixes: 63940449555e ("eventfs: Implement eventfs lookup, read, open functions") Link: https://lore.kernel.org/linux-trace-kernel/20231208183601.GA46-beaub@linux.microsoft.com/ Signed-off-by: Beau Belgrave --- Please note the fixes tag is the first add of simple_lookup logic, there have been other changes beyond that may be a better fit to targetting. fs/tracefs/event_inode.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index f8a594a50ae6..d2c06ba26db4 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -561,6 +561,8 @@ static struct dentry *eventfs_root_lookup(struct inode *dir, if (strcmp(ei_child->name, name) != 0) continue; ret = simple_lookup(dir, dentry, flags); + if (IS_ERR(ret)) + goto out; create_dir_dentry(ei, ei_child, ei_dentry, true); created = true; break; @@ -583,6 +585,8 @@ static struct dentry *eventfs_root_lookup(struct inode *dir, if (r <= 0) continue; ret = simple_lookup(dir, dentry, flags); + if (IS_ERR(ret)) + goto out; create_file_dentry(ei, i, ei_dentry, name, mode, cdata, fops, true); break;