summaryrefslogtreecommitdiff
path: root/sys/src/9/ip
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-09-21 19:24:38 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2014-09-21 19:24:38 +0200
commit84c40fb226e374efe05bb7d7eaa4f43f713f4929 (patch)
treeaefa209f7d0d8c744d0b6664d9dde944227df566 /sys/src/9/ip
parent59ab557f31068c91492af16d73ab9b3628ead21d (diff)
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.
Diffstat (limited to 'sys/src/9/ip')
-rw-r--r--sys/src/9/ip/devip.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/src/9/ip/devip.c b/sys/src/9/ip/devip.c
index 38ba0f81c..e63a4f5ba 100644
--- a/sys/src/9/ip/devip.c
+++ b/sys/src/9/ip/devip.c
@@ -1243,6 +1243,10 @@ Fsproto(Fs *f, Proto *p)
p->qid.type = QTDIR;
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));
if(p->conv == nil)
panic("Fsproto");