Skip to content

Commit

Permalink
ahci: Do not unmap NULL addresses
Browse files Browse the repository at this point in the history
Definitely don't try to unmap a garbage address.

Reported-by: Zuozhi fzz <zuozhi.fzz@alibaba-inc.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1454103689-13042-2-git-send-email-jsnow@redhat.com
  • Loading branch information
jnsnow committed Feb 10, 2016
1 parent c691320 commit 99b4cb7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hw/ide/ahci.c
Expand Up @@ -662,6 +662,10 @@ static bool ahci_map_fis_address(AHCIDevice *ad)

static void ahci_unmap_fis_address(AHCIDevice *ad)
{
if (ad->res_fis == NULL) {
DPRINTF(ad->port_no, "Attempt to unmap NULL FIS address\n");
return;
}
dma_memory_unmap(ad->hba->as, ad->res_fis, 256,
DMA_DIRECTION_FROM_DEVICE, 256);
ad->res_fis = NULL;
Expand All @@ -678,6 +682,10 @@ static bool ahci_map_clb_address(AHCIDevice *ad)

static void ahci_unmap_clb_address(AHCIDevice *ad)
{
if (ad->lst == NULL) {
DPRINTF(ad->port_no, "Attempt to unmap NULL CLB address\n");
return;
}
dma_memory_unmap(ad->hba->as, ad->lst, 1024,
DMA_DIRECTION_FROM_DEVICE, 1024);
ad->lst = NULL;
Expand Down

0 comments on commit 99b4cb7

Please sign in to comment.