瀏覽代碼

powerpc/powernv: Fix corrupted PE allocation bitmap on releasing PE

In pnv_ioda_free_pe(), the PE object (including the associated PE
number) is cleared before resetting the corresponding bit in the
PE allocation bitmap. It means PE#0 is always released to the bitmap
wrongly.

This fixes above issue by caching the PE number before the PE object
is cleared.

Fixes: 1e9167726c41 ("powerpc/powernv: Use PE instead of number during setup and release"
Cc: stable@vger.kernel.org # v4.7+
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Gavin Shan 9 年之前
父節點
當前提交
caa58f8088
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      arch/powerpc/platforms/powernv/pci-ioda.c

+ 2 - 1
arch/powerpc/platforms/powernv/pci-ioda.c

@@ -162,11 +162,12 @@ static struct pnv_ioda_pe *pnv_ioda_alloc_pe(struct pnv_phb *phb)
 static void pnv_ioda_free_pe(struct pnv_ioda_pe *pe)
 static void pnv_ioda_free_pe(struct pnv_ioda_pe *pe)
 {
 {
 	struct pnv_phb *phb = pe->phb;
 	struct pnv_phb *phb = pe->phb;
+	unsigned int pe_num = pe->pe_number;
 
 
 	WARN_ON(pe->pdev);
 	WARN_ON(pe->pdev);
 
 
 	memset(pe, 0, sizeof(struct pnv_ioda_pe));
 	memset(pe, 0, sizeof(struct pnv_ioda_pe));
-	clear_bit(pe->pe_number, phb->ioda.pe_alloc);
+	clear_bit(pe_num, phb->ioda.pe_alloc);
 }
 }
 
 
 /* The default M64 BAR is shared by all PEs */
 /* The default M64 BAR is shared by all PEs */