Fixes tcpackproc name's memory
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 8 Apr 2014 02:52:29 +0000 (19:52 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 8 Apr 2014 02:52:29 +0000 (19:52 -0700)
Our ktasks (possibly foolishly) don't make a copy of the name for the
caller.  So the caller (or rather the ktask itself) needs to free the
memory for the kname when it is done.

Probably should change this.

kern/src/net/tcp.c
kern/src/process.c

index 3457d85..9fe9ef3 100644 (file)
@@ -856,14 +856,15 @@ void tcpstart(struct conv *s, int mode)
 {
        Tcpctl *tcb;
        struct tcppriv *tpriv;
-       char kpname[KNAMELEN];
+       /* tcpackproc needs to free this if it ever exits */
+       char *kpname = kmalloc(KNAMELEN, KMALLOC_WAIT);
 
        tpriv = s->p->priv;
 
        if (tpriv->ackprocstarted == 0) {
                qlock(&tpriv->apl);
                if (tpriv->ackprocstarted == 0) {
-                       snprintf(kpname, sizeof(kpname), "#I%dtcpack", s->p->f->dev);
+                       snprintf(kpname, KNAMELEN, "#I%dtcpack", s->p->f->dev);
                        ktask(kpname, tcpackproc, s->p);
                        tpriv->ackprocstarted = 1;
                }
index f27c36d..16e8060 100644 (file)
@@ -2186,6 +2186,7 @@ void print_proc_info(pid_t pid)
        printk("PID: %d\n", p->pid);
        printk("PPID: %d\n", p->ppid);
        printk("State: %s (%p)\n", procstate2str(p->state), p->state);
+       printk("\tIs %san MCP\n", p->procinfo->is_mcp ? "" : "not ");
        printk("Refcnt: %d\n", atomic_read(&p->p_kref.refcount) - 1);
        printk("Flags: 0x%08x\n", p->env_flags);
        printk("CR3(phys): %p\n", p->env_cr3);