diff options
| author | Takashi Iwai <tiwai@suse.de> | 2009-12-17 14:27:22 +0300 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2009-12-17 14:27:22 +0300 |
| commit | 67cbf8a216259dceefe570f6dc14746f43b2e627 (patch) | |
| tree | 1eca0b9922dee01b4d00dc0713b7ff434dddd44c /fs/exec.c | |
| parent | 6c941c8556dd9269be621cd8159fc60e955a91b3 (diff) | |
| parent | 2fbe74b90bafebce615466b4c20f96b0465df1ae (diff) | |
| download | linux-67cbf8a216259dceefe570f6dc14746f43b2e627.tar.xz | |
Merge branch 'fix/misc' into topic/misc
Diffstat (limited to 'fs/exec.c')
| -rw-r--r-- | fs/exec.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/exec.c b/fs/exec.c index c0c636e34f60..623a5cc3076a 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -923,6 +923,15 @@ char *get_task_comm(char *buf, struct task_struct *tsk) void set_task_comm(struct task_struct *tsk, char *buf) { task_lock(tsk); + + /* + * Threads may access current->comm without holding + * the task lock, so write the string carefully. + * Readers without a lock may see incomplete new + * names but are safe from non-terminating string reads. + */ + memset(tsk->comm, 0, TASK_COMM_LEN); + wmb(); strlcpy(tsk->comm, buf, sizeof(tsk->comm)); task_unlock(tsk); perf_event_comm(tsk); |
