diff options
author | Dustin Kirkland <dustin.kirkland@us.ibm.com> | 2005-11-16 10:53:13 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2006-03-20 14:08:54 -0500 |
commit | 7306a0b9b3e2056a616c84841288ca2431a05627 (patch) | |
tree | d3f61ef43c7079790d6b8ef9bf307689a7d9ea16 /kernel/auditsc.c | |
parent | 8c8570fb8feef2bc166bee75a85748b25cda22d9 (diff) |
[PATCH] Miscellaneous bug and warning fixes
This patch fixes a couple of bugs revealed in new features recently
added to -mm1:
* fixes warnings due to inconsistent use of const struct inode *inode
* fixes bug that prevent a kernel from booting with audit on, and SELinux off
due to a missing function in security/dummy.c
* fixes a bug that throws spurious audit_panic() messages due to a missing
return just before an error_path label
* some reasonable house cleaning in audit_ipc_context(),
audit_inode_context(), and audit_log_task_context()
Signed-off-by: Dustin Kirkland <dustin.kirkland@us.ibm.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r-- | kernel/auditsc.c | 21 |
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 | ||
906 | error_path: | 905 | error_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) | |||
1304 | void audit_inode_context(int idx, const struct inode *inode) | 1303 | void 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 | ||
1329 | error_path: | 1331 | error_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"); |
1335 | ret: | ||
1333 | return; | 1336 | return; |
1334 | } | 1337 | } |
1335 | 1338 | ||