s390/pci: fix use after free in dma_init
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Fri, 15 Apr 2016 07:41:35 +0000 (09:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2017 12:04:33 +0000 (14:04 +0200)
commitab6c86a0042d93b3ca15bbea29e22266a85a400f
treeedd60539758e48707a8c0cc81522fd6113c070c9
parent2b49b1938b5c74e90748d56999edf939e3251f24
s390/pci: fix use after free in dma_init

commit dba599091c191d209b1499511a524ad9657c0e5a upstream.

After a failure during registration of the dma_table (because of the
function being in error state) we free its memory but don't reset the
associated pointer to zero.

When we then receive a notification from firmware (about the function
being in error state) we'll try to walk and free the dma_table again.

Fix this by resetting the dma_table pointer. In addition to that make
sure that we free the iommu_bitmap when appropriate.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Willy Tarreau <w@1wt.eu>
arch/s390/pci/pci_dma.c