Commit 308c813b authored by Mike Marciniszyn's avatar Mike Marciniszyn Committed by Roland Dreier

IB/qib: Fix module-level leak

The vzalloc()'ed field physshadow is leaked on module unload.

This patch adds vfree after the sibling page shadow is freed.
Reported-by: default avatarDean Luick <dean.luick@intel.com>
Reviewed-by: default avatarDean Luick <dean.luick@intel.com>
Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 22baa407
...@@ -1350,7 +1350,7 @@ static void cleanup_device_data(struct qib_devdata *dd) ...@@ -1350,7 +1350,7 @@ static void cleanup_device_data(struct qib_devdata *dd)
if (dd->pageshadow) { if (dd->pageshadow) {
struct page **tmpp = dd->pageshadow; struct page **tmpp = dd->pageshadow;
dma_addr_t *tmpd = dd->physshadow; dma_addr_t *tmpd = dd->physshadow;
int i, cnt = 0; int i;
for (ctxt = 0; ctxt < dd->cfgctxts; ctxt++) { for (ctxt = 0; ctxt < dd->cfgctxts; ctxt++) {
int ctxt_tidbase = ctxt * dd->rcvtidcnt; int ctxt_tidbase = ctxt * dd->rcvtidcnt;
...@@ -1363,13 +1363,13 @@ static void cleanup_device_data(struct qib_devdata *dd) ...@@ -1363,13 +1363,13 @@ static void cleanup_device_data(struct qib_devdata *dd)
PAGE_SIZE, PCI_DMA_FROMDEVICE); PAGE_SIZE, PCI_DMA_FROMDEVICE);
qib_release_user_pages(&tmpp[i], 1); qib_release_user_pages(&tmpp[i], 1);
tmpp[i] = NULL; tmpp[i] = NULL;
cnt++;
} }
} }
tmpp = dd->pageshadow;
dd->pageshadow = NULL; dd->pageshadow = NULL;
vfree(tmpp); vfree(tmpp);
dd->physshadow = NULL;
vfree(tmpd);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment