net: Clear stale synth_buf pointer
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 11 Oct 2018 20:30:49 +0000 (16:30 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 11 Oct 2018 20:30:49 +0000 (16:30 -0400)
No one should use synth_buf that did not set it, but this prevents
reusing the pointer.  Or at least it prevents reusing a non-NULL
pointer.  =)

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/src/net/devip.c

index fede257..21cf1f8 100644 (file)
@@ -772,8 +772,10 @@ static void ipclose(struct chan *c)
                                atomic_dec(&f->p[PROTO(c->qid)]->conv[CONV(c->qid)]->snoopers);
                        break;
                case Qiproute:
-                       if (c->flag & COPEN)
+                       if (c->flag & COPEN) {
                                kpages_free(c->synth_buf, IPROUTE_LEN);
+                               c->synth_buf = NULL;
+                       }
                        break;
        }
        kfree(((struct IPaux *)c->aux)->owner);