From c04d905f6c7c41f137de7e4a9279e5c938eb19ef Mon Sep 17 00:00:00 2001 From: Bernd Schubert Date: Mon, 23 Oct 2023 20:47:18 +0200 Subject: [PATCH] vfs: Convert BUG_ON to WARN_ON_ONCE in open_last_lookups The calling code actually handles -ECHILD, so this BUG_ON can be converted to WARN_ON_ONCE. Signed-off-by: Bernd Schubert Link: https://lore.kernel.org/r/20231023184718.11143-1-bschubert@ddn.com Cc: Christian Brauner Cc: Al Viro Cc: Amir Goldstein Cc: Dharmendra Singh Cc: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Christian Brauner --- fs/namei.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/namei.c b/fs/namei.c index 127c868a8992..8571855c281d 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3516,7 +3516,8 @@ static const char *open_last_lookups(struct nameidata *nd, if (likely(dentry)) goto finish_lookup; - BUG_ON(nd->flags & LOOKUP_RCU); + if (WARN_ON_ONCE(nd->flags & LOOKUP_RCU)) + return ERR_PTR(-ECHILD); } else { /* create side of things */ if (nd->flags & LOOKUP_RCU) {