On Wed, Nov 9, 2022 at 11:36 PM Paul Moore <paul@xxxxxxxxxxxxxx> wrote: > > 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. > > Signed-off-by: Paul Moore <paul@xxxxxxxxxxxxxx> > --- > fs/xattr.c | 5 +++-- > include/linux/xattr.h | 6 +++--- > security/apparmor/domain.c | 3 +-- > security/commoncap.c | 22 ++++++++++------------ > security/integrity/evm/evm_crypto.c | 5 +++-- > security/integrity/evm/evm_main.c | 7 +++++-- > security/integrity/ima/ima.h | 5 +++-- > security/integrity/ima/ima_appraise.c | 6 +++--- > security/integrity/ima/ima_main.c | 6 ++++-- > security/integrity/ima/ima_template_lib.c | 11 +++++------ > 10 files changed, 40 insertions(+), 36 deletions(-) Mimi, I'm particularly interested in your thoughts on this patch as there are a number of places in the IMA/EVM code that needed some additional tweaks to prevent a memory leak like we fixed in the capabilities code via 8cf0a1bc1287 ("capabilities: fix potential memleak on error path from vfs_getxattr_alloc()"). -- paul-moore.com