]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ext4: fix ERR_PTR(0) in ext4_mkdir()
authorHongling Zeng <zenghongling@kylinos.cn>
Thu, 4 Jun 2026 07:36:47 +0000 (15:36 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 10 Jun 2026 14:43:24 +0000 (10:43 -0400)
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 <zenghongling@kylinos.cn>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Baokun Li <libaokun@linux.alibaba.com>
Link: https://patch.msgid.link/20260604073647.211279-1-zenghongling@kylinos.cn
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/namei.c

index c0cabf1720200c20624f35868dcfaed88d2ed55b..cc49ae04a6f649dc563cca010c6d314cb4cbf515 100644 (file)
@@ -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;
 }
 
 /*