]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
apparmor: Fix return in ns_mkdir_op
authorHongling Zeng <zenghongling@kylinos.cn>
Sun, 3 May 2026 04:12:43 +0000 (12:12 +0800)
committerJohn Johansen <john.johansen@canonical.com>
Sun, 14 Jun 2026 03:14:07 +0000 (20:14 -0700)
Return NULL instead of passing to ERR_PTR while error is zero.
  Fixes smatch warning:
    - security/apparmor/apparmorfs.c:1846 ns_mkdir_op() warn:
      passing zero to 'ERR_PTR'

Fixes: 88d5baf69082 ("Change inode_operations.mkdir to return struct dentry *")
Reviewed-by: Ryan Lee <ryan.lee@canonical.com>
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/apparmorfs.c

index a59c4b83620f3e045f8aa011c3c74f2c33e5c043..94b8c79792310801505a7ec667c21681053bbfc9 100644 (file)
@@ -1975,7 +1975,7 @@ out:
        mutex_unlock(&parent->lock);
        aa_put_ns(parent);
 
-       return ERR_PTR(error);
+       return error ? ERR_PTR(error) : NULL;
 }
 
 static int ns_rmdir_op(struct inode *dir, struct dentry *dentry)