Inter-revision diff: patch 27

Comparing v7 (message) to v8 (message)

--- v7
+++ v8
@@ -1,13 +1,13 @@
 Add an entry /proc/.../attr/context which displays the full
 process security "context" in compound format:'
-	lsm1\0value\0lsm2\0value\0...
+        lsm1\0value\0lsm2\0value\0...
 This entry is not writable.
 
 Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
 ---
  fs/proc/base.c      |  1 +
- security/security.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 46 insertions(+)
+ security/security.c | 27 +++++++++++++++++++++++++++
+ 2 files changed, 28 insertions(+)
 
 diff --git a/fs/proc/base.c b/fs/proc/base.c
 index 7bf70e041315..79600df5f7a2 100644
@@ -22,25 +22,21 @@
  	DIR("smack",			0555,
  	    proc_smack_attr_dir_inode_ops, proc_smack_attr_dir_ops),
 diff --git a/security/security.c b/security/security.c
-index 0ea7ee27e331..e9f579483d12 100644
+index 8cb91f33c166..d151ac4a398b 100644
 --- a/security/security.c
 +++ b/security/security.c
-@@ -2046,6 +2046,14 @@ int security_getprocattr(struct task_struct *p, const char *lsm, char *name,
+@@ -2082,6 +2082,10 @@ int security_getprocattr(struct task_struct *p, const char *lsm, char *name,
  				char **value)
  {
  	struct security_hook_list *hp;
 +	char *final = NULL;
 +	char *cp;
-+	char *tp;
 +	int rc = 0;
 +	int finallen = 0;
-+	int llen;
-+	int clen;
-+	int tlen;
  	int display = lsm_task_display(current);
  	int slot = 0;
  
-@@ -2063,6 +2071,43 @@ int security_getprocattr(struct task_struct *p, const char *lsm, char *name,
+@@ -2099,6 +2103,29 @@ int security_getprocattr(struct task_struct *p, const char *lsm, char *name,
  		return -ENOMEM;
  	}
  
@@ -54,26 +50,12 @@
 +				kfree(final);
 +				return rc;
 +			}
-+			llen = strlen(hp->lsmid->lsm) + 1;
-+			clen = strlen(cp) + 1;
-+			tlen = llen + clen;
-+			if (final)
-+				tlen += finallen;
-+			tp = kzalloc(tlen, GFP_KERNEL);
-+			if (tp == NULL) {
-+				kfree(cp);
++			rc = append_ctx(&final, &finallen, hp->lsmid->lsm,
++					cp, rc);
++			if (rc < 0) {
 +				kfree(final);
-+				return -ENOMEM;
++				return rc;
 +			}
-+			if (final)
-+				memcpy(tp, final, finallen);
-+			memcpy(tp + finallen, hp->lsmid->lsm, llen);
-+			memcpy(tp + finallen + llen, cp, clen);
-+			kfree(cp);
-+			if (final)
-+				kfree(final);
-+			final = tp;
-+			finallen = tlen;
 +		}
 +		if (final == NULL)
 +			return -EINVAL;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help