diff options
Diffstat (limited to 'drivers/connector')
-rw-r--r-- | drivers/connector/cn_proc.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index 354c1ff17159..c5afc98e2675 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c | |||
@@ -106,6 +106,7 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
106 | struct proc_event *ev; | 106 | struct proc_event *ev; |
107 | __u8 buffer[CN_PROC_MSG_SIZE]; | 107 | __u8 buffer[CN_PROC_MSG_SIZE]; |
108 | struct timespec ts; | 108 | struct timespec ts; |
109 | const struct cred *cred; | ||
109 | 110 | ||
110 | if (atomic_read(&proc_event_num_listeners) < 1) | 111 | if (atomic_read(&proc_event_num_listeners) < 1) |
111 | return; | 112 | return; |
@@ -115,14 +116,19 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
115 | ev->what = which_id; | 116 | ev->what = which_id; |
116 | ev->event_data.id.process_pid = task->pid; | 117 | ev->event_data.id.process_pid = task->pid; |
117 | ev->event_data.id.process_tgid = task->tgid; | 118 | ev->event_data.id.process_tgid = task->tgid; |
119 | rcu_read_lock(); | ||
120 | cred = __task_cred(task); | ||
118 | if (which_id == PROC_EVENT_UID) { | 121 | if (which_id == PROC_EVENT_UID) { |
119 | ev->event_data.id.r.ruid = task->cred->uid; | 122 | ev->event_data.id.r.ruid = cred->uid; |
120 | ev->event_data.id.e.euid = task->cred->euid; | 123 | ev->event_data.id.e.euid = cred->euid; |
121 | } else if (which_id == PROC_EVENT_GID) { | 124 | } else if (which_id == PROC_EVENT_GID) { |
122 | ev->event_data.id.r.rgid = task->cred->gid; | 125 | ev->event_data.id.r.rgid = cred->gid; |
123 | ev->event_data.id.e.egid = task->cred->egid; | 126 | ev->event_data.id.e.egid = cred->egid; |
124 | } else | 127 | } else { |
128 | rcu_read_unlock(); | ||
125 | return; | 129 | return; |
130 | } | ||
131 | rcu_read_unlock(); | ||
126 | get_seq(&msg->seq, &ev->cpu); | 132 | get_seq(&msg->seq, &ev->cpu); |
127 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 133 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
128 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 134 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |