Skip to contentSkip to conversation

fs/smb/server/smbacl.c:793 parse_sec_desc() warn: missing error code? 'rc'

PATCH kernel test robot 2 participants 2 messages Nov 26

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

Unfiltered warning: this smatch report is sent as-is and has not been reviewed for false positives, so please treat it with due skepticism.

BCC: [email protected]
CC: [email protected]
TO: Ian Bridges <[email protected]>
CC: Namjae Jeon <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/smb.git ksmbd-for-next
head:   f9208b7a49196e36c0434637ab83e001f5800a1d
commit: f9208b7a49196e36c0434637ab83e001f5800a1d [48/48] ksmbd: use the security descriptor codec in callers

:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago
config: sparc-randconfig-2200-20261126 (https://download.01.org/0day-ci/archive/20261126/[email protected]/config)
compiler: sparc-linux-gcc (GCC) 13.5.0
smatch: v0.5.0-9187-g5189e3fb

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags

| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
fs/smb/server/smbacl.c:793 parse_sec_desc() warn: missing error code? 'rc'

vim +/rc +793 fs/smb/server/smbacl.c

e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  766  
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  767  /* Convert CIFS ACL to POSIX form */
1923c1065fe94c fs/smb/server/smbacl.c Christian Brauner         2026-09-01  768  int parse_sec_desc(const struct mnt_idmap *idmap, struct smb_ntsd *pntsd,
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  769  		   int acl_len, struct smb_fattr *fattr, struct ksmbd_sd **psd)
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  770  {
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  771  	int rc = 0;
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  772  	const struct smb_sid *owner_sid_ptr = NULL, *group_sid_ptr = NULL;
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  773  	struct ksmbd_sd *sd __free(kvfree) = NULL;
548e9ad317393b fs/cifsd/smbacl.c      Namjae Jeon               2021-03-21  774  	int pntsd_type;
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  775  
64b39f4a2fd293 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-30  776  	if (!pntsd)
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  777  		return -EIO;
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  778  
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  779  	if (acl_len < (int)sizeof(struct smb_ntsd))
8f77150c15f877 fs/ksmbd/smbacl.c      Hyunchul Lee              2021-09-24  780  		return -EINVAL;
8f77150c15f877 fs/ksmbd/smbacl.c      Hyunchul Lee              2021-09-24  781  
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  782  	/* Refuse an SD from a client if the decoder left a part out */
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  783  	rc = ksmbd_sd_decode((u8 *)pntsd, acl_len, &sd);
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  784  	if (rc == -EBADMSG || (!rc && sd->part_dropped))
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  785  		rc = -EINVAL;
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  786  	if (rc)
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  787  		return rc;
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  788  
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  789  	pntsd_type = sd->control;
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  790  	if (sd->dacl == KSMBD_ACL_ABSENT) {
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  791  		ksmbd_debug(SMB, "DACL_PRESENT in DACL type is not set\n");
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  792  		*psd = no_free_ptr(sd);
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16 @793  		return rc;
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  794  	}
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  795  
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  796  	/* The stored SD keeps only the Control bits set below and no SACL */
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  797  	sd->control = 0;
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  798  	sd->sacl = KSMBD_ACL_ABSENT;
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  799  	sd->sacl_len = 0;
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  800  
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  801  	if (sd->owner) {
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  802  		owner_sid_ptr = sd->owner;
4d7ca4090184c1 fs/ksmbd/smbacl.c      Christian Brauner         2023-01-13  803  		rc = sid_to_id(idmap, owner_sid_ptr, SIDOWNER, fattr);
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  804  		if (rc) {
fbe0bb2b75eb3c fs/smb/server/smbacl.c Namjae Jeon               2026-07-01  805  			ksmbd_debug(SMB, "Owner SID has no Unix uid mapping\n");
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  806  			owner_sid_ptr = NULL;
fbe0bb2b75eb3c fs/smb/server/smbacl.c Namjae Jeon               2026-07-01  807  			rc = 0;
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  808  		}
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  809  	}
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  810  
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  811  	if (sd->group) {
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  812  		group_sid_ptr = sd->group;
4d7ca4090184c1 fs/ksmbd/smbacl.c      Christian Brauner         2023-01-13  813  		rc = sid_to_id(idmap, group_sid_ptr, SIDUNIX_GROUP, fattr);
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  814  		if (rc) {
fbe0bb2b75eb3c fs/smb/server/smbacl.c Namjae Jeon               2026-07-01  815  			ksmbd_debug(SMB, "Group SID has no Unix gid mapping\n");
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  816  			group_sid_ptr = NULL;
fbe0bb2b75eb3c fs/smb/server/smbacl.c Namjae Jeon               2026-07-01  817  			rc = 0;
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  818  		}
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  819  	}
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  820  
070fb21e5912b6 fs/cifsd/smbacl.c      Namjae Jeon               2021-05-26  821  	if ((pntsd_type & (DACL_AUTO_INHERITED | DACL_AUTO_INHERIT_REQ)) ==
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  822  	    (DACL_AUTO_INHERITED | DACL_AUTO_INHERIT_REQ))
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  823  		sd->control |= DACL_AUTO_INHERITED;
e2f34481b24db2 fs/cifsd/smbacl.c      Namjae Jeon               2021-03-16  824  	if (pntsd_type & DACL_PROTECTED)
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  825  		sd->control |= DACL_PROTECTED;
d6e13e19063db2 fs/smb/server/smbacl.c Namjae Jeon               2025-02-18  826  
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  827  	rc = parse_dacl(idmap, sd, owner_sid_ptr, group_sid_ptr, fattr);
c61dc7b1b4a323 fs/smb/server/smbacl.c Namjae Jeon               2026-08-25  828  	if (rc)
c61dc7b1b4a323 fs/smb/server/smbacl.c Namjae Jeon               2026-08-25  829  		return rc;
fda9522ed6afae fs/smb/server/smbacl.c Asim Viladi Oglu Manizada 2026-03-25  830  
f9208b7a49196e fs/smb/server/smbacl.c Ian Bridges               2026-11-26  831  	*psd = no_free_ptr(sd);
fda9522ed6afae fs/smb/server/smbacl.c Asim Viladi Oglu Manizada 2026-03-25  832  	return 0;
fda9522ed6afae fs/smb/server/smbacl.c Asim Viladi Oglu Manizada 2026-03-25  833  }
fda9522ed6afae fs/smb/server/smbacl.c Asim Viladi Oglu Manizada 2026-03-25  834  

:::::: The code at line 793 was first introduced by commit
:::::: e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9 cifsd: add server-side procedures for SMB3

:::::: TO: Namjae Jeon <[email protected]>
:::::: CC: Steve French <[email protected]>

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 8 lines · Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/smb.git ksmbd-for-next
head:   f9208b7a49196e36c0434637ab83e001f5800a1d
commit: f9208b7a49196e36c0434637ab83e001f5800a1d [48/48] ksmbd: use the security descriptor codec in callers
config: sparc-randconfig-2200-20261126 (https://download.01.org/0day-ci/archive/20261126/[email protected]/config)
compiler: sparc-linux-gcc (GCC) 13.5.0
smatch: v0.5.0-9187-g5189e3fb
Quoted 8 lines

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags

| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
fs/smb/server/smbacl.c:793 parse_sec_desc() warn: missing error code? 'rc'

I will fix it.
Thanks for the report.