projects/linux·commit 78a089d0

Merge tag 'lsm-pr-20221031' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm

78a089d0 · Linus Torvalds <[email protected]> · 2022-10-31 12:09:42 -07:00

Pull LSM fix from Paul Moore:
 "A single patch to the capabilities code to fix a potential memory leak
  in the xattr allocation error handling"

* tag 'lsm-pr-20221031' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm:
  capabilities: fix potential memleak on error path from vfs_getxattr_alloc()
Commit
78a089d033bf71d68d978ac4cc73070f3e71c736
Parents
30a0b95b · 8cf0a1bc

Merge commit. Changes below are compared with the first parent: 30a0b95b.

Changes

1 files changed · +4 −2

FileStatusAddDelContent
security/commoncap.cmodified+4−2View file

security/commoncap.c

View file
diff --git a/security/commoncap.c b/security/commoncap.c
index 5fc8986..bc751fa 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -401,8 +401,10 @@ int cap_inode_getsecurity(struct user_namespace *mnt_userns,
&tmpbuf, size, GFP_NOFS);
dput(dentry);
- if (ret < 0 || !tmpbuf)
- return ret;
+ if (ret < 0 || !tmpbuf) {
+ size = ret;
+ goto out_free;
+ }
fs_ns = inode->i_sb->s_user_ns;
cap = (struct vfs_cap_data *) tmpbuf;