diff options
Diffstat (limited to 'kernel/audit.c')
-rw-r--r-- | kernel/audit.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index f7ab4a479cdd..01082a1d2bc5 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -528,22 +528,20 @@ struct sk_buff *audit_make_reply(int pid, int seq, int type, int done, | |||
528 | { | 528 | { |
529 | struct sk_buff *skb; | 529 | struct sk_buff *skb; |
530 | struct nlmsghdr *nlh; | 530 | struct nlmsghdr *nlh; |
531 | int len = NLMSG_SPACE(size); | ||
532 | void *data; | 531 | void *data; |
533 | int flags = multi ? NLM_F_MULTI : 0; | 532 | int flags = multi ? NLM_F_MULTI : 0; |
534 | int t = done ? NLMSG_DONE : type; | 533 | int t = done ? NLMSG_DONE : type; |
535 | 534 | ||
536 | skb = alloc_skb(len, GFP_KERNEL); | 535 | skb = nlmsg_new(size, GFP_KERNEL); |
537 | if (!skb) | 536 | if (!skb) |
538 | return NULL; | 537 | return NULL; |
539 | 538 | ||
540 | nlh = NLMSG_PUT(skb, pid, seq, t, size); | 539 | nlh = NLMSG_NEW(skb, pid, seq, t, size, flags); |
541 | nlh->nlmsg_flags = flags; | 540 | data = NLMSG_DATA(nlh); |
542 | data = NLMSG_DATA(nlh); | ||
543 | memcpy(data, payload, size); | 541 | memcpy(data, payload, size); |
544 | return skb; | 542 | return skb; |
545 | 543 | ||
546 | nlmsg_failure: /* Used by NLMSG_PUT */ | 544 | nlmsg_failure: /* Used by NLMSG_NEW */ |
547 | if (skb) | 545 | if (skb) |
548 | kfree_skb(skb); | 546 | kfree_skb(skb); |
549 | return NULL; | 547 | return NULL; |
@@ -1083,18 +1081,20 @@ static struct audit_buffer * audit_buffer_alloc(struct audit_context *ctx, | |||
1083 | goto err; | 1081 | goto err; |
1084 | } | 1082 | } |
1085 | 1083 | ||
1086 | ab->skb = alloc_skb(AUDIT_BUFSIZ, gfp_mask); | ||
1087 | if (!ab->skb) | ||
1088 | goto err; | ||
1089 | |||
1090 | ab->ctx = ctx; | 1084 | ab->ctx = ctx; |
1091 | ab->gfp_mask = gfp_mask; | 1085 | ab->gfp_mask = gfp_mask; |
1092 | nlh = (struct nlmsghdr *)skb_put(ab->skb, NLMSG_SPACE(0)); | 1086 | |
1093 | nlh->nlmsg_type = type; | 1087 | ab->skb = nlmsg_new(AUDIT_BUFSIZ, gfp_mask); |
1094 | nlh->nlmsg_flags = 0; | 1088 | if (!ab->skb) |
1095 | nlh->nlmsg_pid = 0; | 1089 | goto nlmsg_failure; |
1096 | nlh->nlmsg_seq = 0; | 1090 | |
1091 | nlh = NLMSG_NEW(ab->skb, 0, 0, type, 0, 0); | ||
1092 | |||
1097 | return ab; | 1093 | return ab; |
1094 | |||
1095 | nlmsg_failure: /* Used by NLMSG_NEW */ | ||
1096 | kfree_skb(ab->skb); | ||
1097 | ab->skb = NULL; | ||
1098 | err: | 1098 | err: |
1099 | audit_buffer_free(ab); | 1099 | audit_buffer_free(ab); |
1100 | return NULL; | 1100 | return NULL; |