VirtualBox

Changeset 48437 in vbox for trunk/src/VBox/NetworkServices


Ignore:
Timestamp:
Sep 11, 2013 5:09:50 PM (11 years ago)
Author:
vboxsync
Message:

sys_mbox_tryfetch() returns timeout, not error code. Real tryfetch
returns only 0 or SYS_MBOX_EMPTY, so this code worked ok in standalone
mode since ERR_OK is also 0. In VBox tryfetch is faked with a fetch
with timeout of 1, so successful fetch may return non-zero value,
causing buggy caller to think tryfetch failed and leak memory.

Location:
trunk/src/VBox/NetworkServices/NAT
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/NAT/fwtcp.c

    r48001 r48437  
    308308    struct fwtcp *fwtcp = (struct fwtcp *)arg;
    309309    struct pxtcp *pxtcp;
    310     err_t error;
     310    u32_t timo;
    311311
    312312    if (!sys_mbox_valid(&fwtcp->connmbox)) {
     
    315315
    316316    pxtcp = NULL;
    317     error = sys_mbox_tryfetch(&fwtcp->connmbox, (void **)&pxtcp);
    318     if (error != ERR_OK) {
     317    timo = sys_mbox_tryfetch(&fwtcp->connmbox, (void **)&pxtcp);
     318    if (timo == SYS_MBOX_EMPTY) {
    319319        return;
    320320    }
  • trunk/src/VBox/NetworkServices/NAT/pxudp.c

    r48001 r48437  
    627627{
    628628    struct pbuf *p;
     629    u32_t timo;
    629630    err_t error;
    630631
     
    633634    }
    634635
    635     error = sys_mbox_tryfetch(&pxudp->inmbox, (void **)&p);
    636     if (error != ERR_OK) {
     636    timo = sys_mbox_tryfetch(&pxudp->inmbox, (void **)&p);
     637    if (timo == SYS_MBOX_EMPTY) {
    637638        return;
    638639    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette