Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 94874
b: refs/heads/master
c: f09ac9d
h: refs/heads/master
v: v3
  • Loading branch information
Eric Paris authored and Al Viro committed Apr 28, 2008
1 parent 9a77dc3 commit 03f41ff
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f3d357b092956959563398b59ef2fdd10aea387d
refs/heads/master: f09ac9db2aafe36fde9ebd63c8c5d776f6e7bd41
40 changes: 35 additions & 5 deletions trunk/kernel/audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ struct audit_buffer {
gfp_t gfp_mask;
};

struct audit_reply {
int pid;
struct sk_buff *skb;
};

static void audit_set_pid(struct audit_buffer *ab, pid_t pid)
{
if (ab) {
Expand Down Expand Up @@ -528,6 +533,19 @@ struct sk_buff *audit_make_reply(int pid, int seq, int type, int done,
return NULL;
}

static int audit_send_reply_thread(void *arg)
{
struct audit_reply *reply = (struct audit_reply *)arg;

mutex_lock(&audit_cmd_mutex);
mutex_unlock(&audit_cmd_mutex);

/* Ignore failure. It'll only happen if the sender goes away,
because our timeout is set to infinite. */
netlink_unicast(audit_sock, reply->skb, reply->pid, 0);
kfree(reply);
return 0;
}
/**
* audit_send_reply - send an audit reply message via netlink
* @pid: process id to send reply to
Expand All @@ -544,14 +562,26 @@ struct sk_buff *audit_make_reply(int pid, int seq, int type, int done,
void audit_send_reply(int pid, int seq, int type, int done, int multi,
void *payload, int size)
{
struct sk_buff *skb;
struct sk_buff *skb;
struct task_struct *tsk;
struct audit_reply *reply = kmalloc(sizeof(struct audit_reply),
GFP_KERNEL);

if (!reply)
return;

skb = audit_make_reply(pid, seq, type, done, multi, payload, size);
if (!skb)
return;
/* Ignore failure. It'll only happen if the sender goes away,
because our timeout is set to infinite. */
netlink_unicast(audit_sock, skb, pid, 0);
return;

reply->pid = pid;
reply->skb = skb;

tsk = kthread_run(audit_send_reply_thread, reply, "audit_send_reply");
if (IS_ERR(tsk)) {
kfree(reply);
kfree_skb(skb);
}
}

/*
Expand Down

0 comments on commit 03f41ff

Please sign in to comment.