diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-12-10 06:58:59 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-01-04 15:14:40 -0500 |
commit | 7392906ea915b9a2c14dea32b3604b4e178f82f7 (patch) | |
tree | 1e4fbe56e3738fade213ef805ec274ea74ac6a1b /kernel | |
parent | e816f370cbadd2afea9f1a42f232d0636137d563 (diff) |
sanitize audit_mq_getsetattr()
* get rid of allocations
* make it return void
* don't duplicate parts of audit_dummy_context()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/auditsc.c | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index fbed62e05bce..c50178c7e245 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -145,12 +145,6 @@ struct audit_aux_data_mq_notify { | |||
145 | struct sigevent notification; | 145 | struct sigevent notification; |
146 | }; | 146 | }; |
147 | 147 | ||
148 | struct audit_aux_data_mq_getsetattr { | ||
149 | struct audit_aux_data d; | ||
150 | mqd_t mqdes; | ||
151 | struct mq_attr mqstat; | ||
152 | }; | ||
153 | |||
154 | struct audit_aux_data_execve { | 148 | struct audit_aux_data_execve { |
155 | struct audit_aux_data d; | 149 | struct audit_aux_data d; |
156 | int argc; | 150 | int argc; |
@@ -248,6 +242,10 @@ struct audit_context { | |||
248 | mode_t perm_mode; | 242 | mode_t perm_mode; |
249 | unsigned long qbytes; | 243 | unsigned long qbytes; |
250 | } ipc; | 244 | } ipc; |
245 | struct { | ||
246 | mqd_t mqdes; | ||
247 | struct mq_attr mqstat; | ||
248 | } mq_getsetattr; | ||
251 | }; | 249 | }; |
252 | 250 | ||
253 | #if AUDIT_DEBUG | 251 | #if AUDIT_DEBUG |
@@ -1269,6 +1267,15 @@ static void show_special(struct audit_context *context, int *call_panic) | |||
1269 | return; | 1267 | return; |
1270 | } | 1268 | } |
1271 | break; } | 1269 | break; } |
1270 | case AUDIT_MQ_GETSETATTR: { | ||
1271 | struct mq_attr *attr = &context->mq_getsetattr.mqstat; | ||
1272 | audit_log_format(ab, | ||
1273 | "mqdes=%d mq_flags=0x%lx mq_maxmsg=%ld mq_msgsize=%ld " | ||
1274 | "mq_curmsgs=%ld ", | ||
1275 | context->mq_getsetattr.mqdes, | ||
1276 | attr->mq_flags, attr->mq_maxmsg, | ||
1277 | attr->mq_msgsize, attr->mq_curmsgs); | ||
1278 | break; } | ||
1272 | } | 1279 | } |
1273 | audit_log_end(ab); | 1280 | audit_log_end(ab); |
1274 | } | 1281 | } |
@@ -1377,16 +1384,6 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts | |||
1377 | axi->notification.sigev_signo); | 1384 | axi->notification.sigev_signo); |
1378 | break; } | 1385 | break; } |
1379 | 1386 | ||
1380 | case AUDIT_MQ_GETSETATTR: { | ||
1381 | struct audit_aux_data_mq_getsetattr *axi = (void *)aux; | ||
1382 | audit_log_format(ab, | ||
1383 | "mqdes=%d mq_flags=0x%lx mq_maxmsg=%ld mq_msgsize=%ld " | ||
1384 | "mq_curmsgs=%ld ", | ||
1385 | axi->mqdes, | ||
1386 | axi->mqstat.mq_flags, axi->mqstat.mq_maxmsg, | ||
1387 | axi->mqstat.mq_msgsize, axi->mqstat.mq_curmsgs); | ||
1388 | break; } | ||
1389 | |||
1390 | case AUDIT_EXECVE: { | 1387 | case AUDIT_EXECVE: { |
1391 | struct audit_aux_data_execve *axi = (void *)aux; | 1388 | struct audit_aux_data_execve *axi = (void *)aux; |
1392 | audit_log_execve_info(context, &ab, axi); | 1389 | audit_log_execve_info(context, &ab, axi); |
@@ -2316,30 +2313,13 @@ int __audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification) | |||
2316 | * @mqdes: MQ descriptor | 2313 | * @mqdes: MQ descriptor |
2317 | * @mqstat: MQ flags | 2314 | * @mqstat: MQ flags |
2318 | * | 2315 | * |
2319 | * Returns 0 for success or NULL context or < 0 on error. | ||
2320 | */ | 2316 | */ |
2321 | int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat) | 2317 | void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat) |
2322 | { | 2318 | { |
2323 | struct audit_aux_data_mq_getsetattr *ax; | ||
2324 | struct audit_context *context = current->audit_context; | 2319 | struct audit_context *context = current->audit_context; |
2325 | 2320 | context->mq_getsetattr.mqdes = mqdes; | |
2326 | if (!audit_enabled) | 2321 | context->mq_getsetattr.mqstat = *mqstat; |
2327 | return 0; | 2322 | context->type = AUDIT_MQ_GETSETATTR; |
2328 | |||
2329 | if (likely(!context)) | ||
2330 | return 0; | ||
2331 | |||
2332 | ax = kmalloc(sizeof(*ax), GFP_ATOMIC); | ||
2333 | if (!ax) | ||
2334 | return -ENOMEM; | ||
2335 | |||
2336 | ax->mqdes = mqdes; | ||
2337 | ax->mqstat = *mqstat; | ||
2338 | |||
2339 | ax->d.type = AUDIT_MQ_GETSETATTR; | ||
2340 | ax->d.next = context->aux; | ||
2341 | context->aux = (void *)ax; | ||
2342 | return 0; | ||
2343 | } | 2323 | } |
2344 | 2324 | ||
2345 | /** | 2325 | /** |