VirtualBox

Changeset 15987 in vbox for trunk/src/VBox/Additions/linux


Ignore:
Timestamp:
Jan 16, 2009 10:36:30 AM (16 years ago)
Author:
vboxsync
Message:

Additions/Linux: return an error if we can't copy back the bounce buffer contents after an R3 HGCM call

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/module/vboxmod.c

    r15720 r15987  
    480480/** Unlock R3 memory after the HGCM call.  Copied from HGCMInternal.cpp and
    481481 * SysHlp.cpp */
    482 static void vboxadd_unbuffer_hgcm_parms(void **ppvCtx, VBoxGuestHGCMCallInfo *pCallInfo)
    483 {
     482static int vboxadd_unbuffer_hgcm_parms(void **ppvCtx, VBoxGuestHGCMCallInfo *pCallInfo)
     483{
     484    int rc = 0;
    484485    unsigned iParm;
    485486    /* Unlock user buffers. */
     
    495496            {
    496497                hgcm_jump_buffer *MemObj = (hgcm_jump_buffer *)ppvCtx[iParm];
    497 #ifdef VBOX_STRICT
    498                 int rc = vboxadd_hgcm_free_buffer(MemObj);
    499                 Assert(rc >= 0);  /* vboxadd_hgcm_unbuffer_user logs this. */
    500 #else
    501                 vboxadd_hgcm_free_buffer(MemObj);
    502 #endif
     498                int rc2 = vboxadd_hgcm_free_buffer(MemObj);
     499                if (rc >= 0 && rc2 < 0)
     500                    rc = rc2;  /* Report the first error. */
    503501            }
    504502        }
    505503        else
    506             Assert(!ppvCtx[iParm]);
    507     }
     504            if (ppvCtx[iParm] != NULL)
     505            {
     506                AssertFailed();
     507                rc = -EOVERFLOW;  /* Something unlikely to turn up elsewhere so
     508                                   * we can see where it's coming from. */
     509            }
     510    }
     511    return rc;
    508512}
    509513
     
    557561        }
    558562        if (haveParms)
    559             vboxadd_unbuffer_hgcm_parms(apvCtx, pInfo);
     563        {
     564            int rc2 = vboxadd_unbuffer_hgcm_parms(apvCtx, pInfo);
     565            if (rc >= 0 && rc2 < 0)
     566                rc = rc2;
     567        }
    560568        if (pInfo != NULL)
    561569            kfree(pInfo);
     
    614622        }
    615623        if (haveParms)
    616             vboxadd_unbuffer_hgcm_parms(apvCtx, &pInfo->info);
     624        {
     625            int rc2 = vboxadd_unbuffer_hgcm_parms(apvCtx, &pInfo->info);
     626            if (rc >= 0 && rc2 < 0)
     627                rc = rc2;
     628        }
    617629        if (pInfo != NULL)
    618630            kfree(pInfo);
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