Ignore bogus omode on devpipe
authorRonald G. Minnich <rminnich@google.com>
Tue, 21 Jan 2014 15:10:46 +0000 (07:10 -0800)
committerRonald G. Minnich <rminnich@google.com>
Tue, 21 Jan 2014 15:10:46 +0000 (07:10 -0800)
Somebody is trying to open directories with
omode of 2048; no idea why.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
kern/drivers/dev/dev.c
kern/drivers/dev/pipe.c

index a3c676f..f50dfd3 100644 (file)
@@ -334,7 +334,7 @@ devpermcheck(char *fileuid, uint32_t perm, int omode)
 
        t = access[omode&3];
        if((t&perm) != t)
-               error(Eperm);
+               error("%s: devpermcheck(%s,0x%x,0x%x) failed", Eperm, fileuid, perm, omode);
 }
 
 struct chan*
index 5cb9ce3..ba643ef 100644 (file)
@@ -97,6 +97,7 @@ pipeattach(char *spec)
        memmove(p->pipedir, pipedir, sizeof(pipedir));
        kstrdup(&p->user, current->user);
        kref_init(&p->ref, pipe_release, 1);
+       qlock_init(&p->qlock);
 
        p->q[0] = qopen(pipealloc.pipeqsize, 0, 0, 0);
        if(p->q[0] == 0)
@@ -221,9 +222,10 @@ pipeopen(struct chan *c, int omode)
        Pipe *p;
 
        if(c->qid.type & QTDIR){
+               /* let it go however */
                if(omode != OREAD)
-                       error(Ebadarg);
-               c->mode = omode;
+                       printk/*error*/("Can only open directories OREAD, mode is %d", omode);
+               c->mode = OREAD; //omode;
                c->flag |= COPEN;
                c->offset = 0;
                return c;