devip: do not lock selftab in ipselftabread(), remove unused fields from Ipself
the Ipselftab is designed to not require locking on read operation. locking the selftab in ipselftabread() risks deadlock when accessing the user buffer creates a fault. remove unused fields from the Ipself struct.
This commit is contained in:
parent
bf4f158707
commit
157d7ebdbd
2 changed files with 3 additions and 7 deletions
|
@ -274,9 +274,9 @@ struct Iplink
|
||||||
Ipself *self;
|
Ipself *self;
|
||||||
Iplifc *lifc;
|
Iplifc *lifc;
|
||||||
Iplink *selflink; /* next link for this local address */
|
Iplink *selflink; /* next link for this local address */
|
||||||
Iplink *lifclink; /* next link for this ifc */
|
Iplink *lifclink; /* next link for this lifc */
|
||||||
ulong expire;
|
|
||||||
Iplink *next; /* free list */
|
Iplink *next; /* free list */
|
||||||
|
ulong expire;
|
||||||
int ref;
|
int ref;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,10 @@ Medium *media[Maxmedia] = { 0 };
|
||||||
struct Ipself
|
struct Ipself
|
||||||
{
|
{
|
||||||
uchar a[IPaddrlen];
|
uchar a[IPaddrlen];
|
||||||
Ipself *hnext; /* next address in the hash table */
|
Ipself *next; /* next address in the hash table */
|
||||||
Iplink *link; /* binding twixt Ipself and Ipifc */
|
Iplink *link; /* binding twixt Ipself and Ipifc */
|
||||||
ulong expire;
|
ulong expire;
|
||||||
uchar type; /* type of address */
|
uchar type; /* type of address */
|
||||||
int ref;
|
|
||||||
Ipself *next; /* free list */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Ipselftab
|
struct Ipselftab
|
||||||
|
@ -1100,7 +1098,6 @@ ipselftabread(Fs *f, char *cp, ulong offset, int n)
|
||||||
|
|
||||||
m = 0;
|
m = 0;
|
||||||
off = offset;
|
off = offset;
|
||||||
qlock(f->self);
|
|
||||||
for(i = 0; i < NHASH && m < n; i++){
|
for(i = 0; i < NHASH && m < n; i++){
|
||||||
for(p = f->self->hash[i]; p != nil && m < n; p = p->next){
|
for(p = f->self->hash[i]; p != nil && m < n; p = p->next){
|
||||||
nifc = 0;
|
nifc = 0;
|
||||||
|
@ -1115,7 +1112,6 @@ ipselftabread(Fs *f, char *cp, ulong offset, int n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qunlock(f->self);
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue