win-pvdrivers

changeset 852:5f986c984bf1

Fix leak of grant entries and memory on save or migrate
author James Harper <james.harper@bendigoit.com.au>
date Wed Feb 16 23:10:04 2011 +1100 (2011-02-16)
parents f1deffa0ea6b
children 0fd4e07ab4ae
files xenpci/xenpci_pdo.c
line diff
     1.1 --- a/xenpci/xenpci_pdo.c	Tue Feb 15 21:41:23 2011 +1100
     1.2 +++ b/xenpci/xenpci_pdo.c	Wed Feb 16 23:10:04 2011 +1100
     1.3 @@ -1501,6 +1501,7 @@ XenPci_Pdo_Suspend(WDFDEVICE device)
     1.4    PVOID setting;
     1.5    PVOID value;
     1.6    PVOID value2;
     1.7 +  int i;
     1.8  
     1.9    KdPrint((__DRIVER_NAME " --> " __FUNCTION__ " (%s)\n", xppdd->path));
    1.10  
    1.11 @@ -1522,12 +1523,19 @@ XenPci_Pdo_Suspend(WDFDEVICE device)
    1.12        {
    1.13          switch (type)
    1.14          {
    1.15 +        case XEN_INIT_TYPE_RING: /* frontend ring */
    1.16 +          FreePages(value);
    1.17 +          break;
    1.18          case XEN_INIT_TYPE_EVENT_CHANNEL: /* frontend event channel */
    1.19          case XEN_INIT_TYPE_EVENT_CHANNEL_DPC: /* frontend event channel bound to dpc */
    1.20          case XEN_INIT_TYPE_EVENT_CHANNEL_IRQ: /* frontend event channel bound to irq */
    1.21            EvtChn_Unbind(xpdd, PtrToUlong(value));
    1.22            EvtChn_Close(xpdd, PtrToUlong(value));
    1.23            break;
    1.24 +        case XEN_INIT_TYPE_GRANT_ENTRIES:
    1.25 +          for (i = 0; i < (int)PtrToUlong(value); i++)
    1.26 +            GntTbl_EndAccess(xpdd, ((grant_ref_t *)value2)[i], FALSE, PtrToUlong(setting));
    1.27 +          break;
    1.28          }
    1.29        }
    1.30      }