Smack: Fix memory leak in smack_inode_getsecctx
authorCasey Schaufler <casey@schaufler-ca.com>
Fri, 1 Jun 2018 17:45:12 +0000 (10:45 -0700)
committerCasey Schaufler <casey@schaufler-ca.com>
Tue, 5 Jun 2018 19:16:01 +0000 (12:16 -0700)
commit0f8983cf97d3327531b7843c831517cac3a1b9ed
tree04978f906764ad6794bf824545ff6b35542f443c
parentb3859ee18ed287170b66b19a78191f7312ec3470
Smack: Fix memory leak in smack_inode_getsecctx

Fix memory leak in smack_inode_getsecctx

The implementation of smack_inode_getsecctx() made
incorrect assumptions about how Smack presents a security
context. Smack does not need to allocate memory to support
security contexts, so "releasing" a Smack context is a no-op.
The code made an unnecessary copy and returned that as a
context, which was never freed. The revised implementation
returns the context correctly.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Reported-by: CHANDAN VN <chandan.vn@samsung.com>
Tested-by: CHANDAN VN <chandan.vn@samsung.com>
security/smack/smack_lsm.c