aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditsc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r--kernel/auditsc.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 4e2256ec7cf3..4ef14515da35 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -892,21 +892,20 @@ static void audit_log_task_context(struct audit_buffer *ab, gfp_t gfp_mask)
892 } 892 }
893 893
894 ctx = kmalloc(len, gfp_mask); 894 ctx = kmalloc(len, gfp_mask);
895 if (!ctx) { 895 if (!ctx)
896 goto error_path; 896 goto error_path;
897 return;
898 }
899 897
900 len = security_getprocattr(current, "current", ctx, len); 898 len = security_getprocattr(current, "current", ctx, len);
901 if (len < 0 ) 899 if (len < 0 )
902 goto error_path; 900 goto error_path;
903 901
904 audit_log_format(ab, " subj=%s", ctx); 902 audit_log_format(ab, " subj=%s", ctx);
903 return;
905 904
906error_path: 905error_path:
907 if (ctx) 906 if (ctx)
908 kfree(ctx); 907 kfree(ctx);
909 audit_panic("security_getprocattr error in audit_log_task_context"); 908 audit_panic("error in audit_log_task_context");
910 return; 909 return;
911} 910}
912 911
@@ -1304,13 +1303,16 @@ void audit_putname(const char *name)
1304void audit_inode_context(int idx, const struct inode *inode) 1303void audit_inode_context(int idx, const struct inode *inode)
1305{ 1304{
1306 struct audit_context *context = current->audit_context; 1305 struct audit_context *context = current->audit_context;
1306 const char *suffix = security_inode_xattr_getsuffix();
1307 char *ctx = NULL; 1307 char *ctx = NULL;
1308 int len = 0; 1308 int len = 0;
1309 1309
1310 if (!security_inode_xattr_getsuffix()) 1310 if (!suffix)
1311 return; 1311 goto ret;
1312 1312
1313 len = security_inode_getsecurity(inode, (char *)security_inode_xattr_getsuffix(), NULL, 0, 0); 1313 len = security_inode_getsecurity(inode, suffix, NULL, 0, 0);
1314 if (len == -EOPNOTSUPP)
1315 goto ret;
1314 if (len < 0) 1316 if (len < 0)
1315 goto error_path; 1317 goto error_path;
1316 1318
@@ -1318,18 +1320,19 @@ void audit_inode_context(int idx, const struct inode *inode)
1318 if (!ctx) 1320 if (!ctx)
1319 goto error_path; 1321 goto error_path;
1320 1322
1321 len = security_inode_getsecurity(inode, (char *)security_inode_xattr_getsuffix(), ctx, len, 0); 1323 len = security_inode_getsecurity(inode, suffix, ctx, len, 0);
1322 if (len < 0) 1324 if (len < 0)
1323 goto error_path; 1325 goto error_path;
1324 1326
1325 kfree(context->names[idx].ctx); 1327 kfree(context->names[idx].ctx);
1326 context->names[idx].ctx = ctx; 1328 context->names[idx].ctx = ctx;
1327 return; 1329 goto ret;
1328 1330
1329error_path: 1331error_path:
1330 if (ctx) 1332 if (ctx)
1331 kfree(ctx); 1333 kfree(ctx);
1332 audit_panic("error in audit_inode_context"); 1334 audit_panic("error in audit_inode_context");
1335ret:
1333 return; 1336 return;
1334} 1337}
1335 1338