From: Hongling Zeng Date: Thu, 4 Jun 2026 07:36:47 +0000 (+0800) Subject: ext4: fix ERR_PTR(0) in ext4_mkdir() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e1c43af7cf5091d99db38b7c8129e394d7f45b5;p=thirdparty%2Fkernel%2Flinux.git ext4: fix ERR_PTR(0) in ext4_mkdir() When mkdir succeeds, ext4_mkdir() returns ERR_PTR(0) which is incorrect. It should return NULL instead for success and ERR_PTR() only with negative error codes for failure. Fixes: 88d5baf69082 ("Change inode_operations.mkdir to return struct dentry *") Signed-off-by: Hongling Zeng Reviewed-by: Jan Kara Reviewed-by: Baokun Li Link: https://patch.msgid.link/20260604073647.211279-1-zenghongling@kylinos.cn Signed-off-by: Theodore Ts'o --- diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index c0cabf1720200..cc49ae04a6f64 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -3054,7 +3054,7 @@ out_stop: out_retry: if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries)) goto retry; - return ERR_PTR(err); + return err ? ERR_PTR(err) : NULL; } /*