devip: sanity check Nchan in Fsproto()
devip can only handle Maskconv+1 conversations per protocol depending on how many bits it uses in the qid to encode the conversation number. we check this when the protocol gets registered. if we do not do this, the kernel will mysteriously panic when the conversaion numbers collide which took some time to debug.
This commit is contained in:
parent
59ab557f31
commit
84c40fb226
1 changed files with 4 additions and 0 deletions
|
@ -1243,6 +1243,10 @@ Fsproto(Fs *f, Proto *p)
|
||||||
|
|
||||||
p->qid.type = QTDIR;
|
p->qid.type = QTDIR;
|
||||||
p->qid.path = QID(f->np, 0, Qprotodir);
|
p->qid.path = QID(f->np, 0, Qprotodir);
|
||||||
|
if(p->nc > Maskconv+1){
|
||||||
|
print("Fsproto: %s nc %d > %d\n", p->name, p->nc, Maskconv+1);
|
||||||
|
p->nc = Maskconv+1;
|
||||||
|
}
|
||||||
p->conv = malloc(sizeof(Conv*)*(p->nc+1));
|
p->conv = malloc(sizeof(Conv*)*(p->nc+1));
|
||||||
if(p->conv == nil)
|
if(p->conv == nil)
|
||||||
panic("Fsproto");
|
panic("Fsproto");
|
||||||
|
|
Loading…
Reference in a new issue