This is a note to let you know that I've just added the patch titled ksmbd: fix posix_acls and acls dereferencing possible ERR_PTR() to the 6.3-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ksmbd-fix-posix_acls-and-acls-dereferencing-possible-err_ptr.patch and it can be found in the queue-6.3 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 25933573ef48f3586f559c2cac6c436c62dcf63f Mon Sep 17 00:00:00 2001 From: Namjae Jeon <linkinjeon@xxxxxxxxxx> Date: Tue, 30 May 2023 21:42:34 +0900 Subject: ksmbd: fix posix_acls and acls dereferencing possible ERR_PTR() From: Namjae Jeon <linkinjeon@xxxxxxxxxx> commit 25933573ef48f3586f559c2cac6c436c62dcf63f upstream. Dan reported the following error message: fs/smb/server/smbacl.c:1296 smb_check_perm_dacl() error: 'posix_acls' dereferencing possible ERR_PTR() fs/smb/server/vfs.c:1323 ksmbd_vfs_make_xattr_posix_acl() error: 'posix_acls' dereferencing possible ERR_PTR() fs/smb/server/vfs.c:1830 ksmbd_vfs_inherit_posix_acl() error: 'acls' dereferencing possible ERR_PTR() __get_acl() returns a mix of error pointers and NULL. This change it with IS_ERR_OR_NULL(). Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@xxxxxxxxxxxxxxx Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/ksmbd/smbacl.c | 4 ++-- fs/ksmbd/vfs.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/fs/ksmbd/smbacl.c +++ b/fs/ksmbd/smbacl.c @@ -1290,7 +1290,7 @@ int smb_check_perm_dacl(struct ksmbd_con if (IS_ENABLED(CONFIG_FS_POSIX_ACL)) { posix_acls = get_inode_acl(d_inode(path->dentry), ACL_TYPE_ACCESS); - if (posix_acls && !found) { + if (!IS_ERR_OR_NULL(posix_acls) && !found) { unsigned int id = -1; pa_entry = posix_acls->a_entries; @@ -1314,7 +1314,7 @@ int smb_check_perm_dacl(struct ksmbd_con } } } - if (posix_acls) + if (!IS_ERR_OR_NULL(posix_acls)) posix_acl_release(posix_acls); } --- a/fs/ksmbd/vfs.c +++ b/fs/ksmbd/vfs.c @@ -1377,7 +1377,7 @@ static struct xattr_smb_acl *ksmbd_vfs_m return NULL; posix_acls = get_inode_acl(inode, acl_type); - if (!posix_acls) + if (IS_ERR_OR_NULL(posix_acls)) return NULL; smb_acl = kzalloc(sizeof(struct xattr_smb_acl) + @@ -1886,7 +1886,7 @@ int ksmbd_vfs_inherit_posix_acl(struct m return -EOPNOTSUPP; acls = get_inode_acl(parent_inode, ACL_TYPE_DEFAULT); - if (!acls) + if (IS_ERR_OR_NULL(acls)) return -ENOENT; pace = acls->a_entries; Patches currently in stable-queue which might be from linkinjeon@xxxxxxxxxx are queue-6.3/ksmbd-check-the-validation-of-pdu_size-in-ksmbd_conn_handler_loop.patch queue-6.3/ksmbd-fix-out-of-bound-read-in-deassemble_neg_contexts.patch queue-6.3/ksmbd-fix-out-of-bound-read-in-parse_lease_state.patch queue-6.3/ksmbd-fix-posix_acls-and-acls-dereferencing-possible-err_ptr.patch