lsm,fs: fix vfs_getxattr_alloc() return type and caller error paths
authorPaul Moore <paul@paul-moore.com>
Wed, 9 Nov 2022 19:14:35 +0000 (14:14 -0500)
committerPaul Moore <paul@paul-moore.com>
Fri, 18 Nov 2022 22:07:03 +0000 (17:07 -0500)
commitf6fbd8cbf3ed1915a7b957f2801f7c306a686c08
treec72891942254302b6a455f09511c3b14f6c2a762
parente68bfbd3b3c3a0ec3cf8c230996ad8cabe90322f
lsm,fs: fix vfs_getxattr_alloc() return type and caller error paths

The vfs_getxattr_alloc() function currently returns a ssize_t value
despite the fact that it only uses int values internally for return
values.  Fix this by converting vfs_getxattr_alloc() to return an
int type and adjust the callers as necessary.  As part of these
caller modifications, some of the callers are fixed to properly free
the xattr value buffer on both success and failure to ensure that
memory is not leaked in the failure case.

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
fs/xattr.c
include/linux/xattr.h
security/apparmor/domain.c
security/commoncap.c
security/integrity/evm/evm_crypto.c
security/integrity/evm/evm_main.c
security/integrity/ima/ima.h
security/integrity/ima/ima_appraise.c
security/integrity/ima/ima_main.c
security/integrity/ima/ima_template_lib.c