Skip to content

Commit

Permalink
mwl8k: fix error handling in mwl8k_post_cmd()
Browse files Browse the repository at this point in the history
If pci_map_single() fails in mwl8k_post_cmd(),
it returns -ENOMEM immediately, while cleanup is required.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
  • Loading branch information
khoroshilov authored and Kalle Valo committed Apr 25, 2019
1 parent b25105e commit d171728
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/net/wireless/marvell/mwl8k.c
Original file line number Diff line number Diff line change
Expand Up @@ -2234,8 +2234,10 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd)
dma_size = le16_to_cpu(cmd->length);
dma_addr = pci_map_single(priv->pdev, cmd, dma_size,
PCI_DMA_BIDIRECTIONAL);
if (pci_dma_mapping_error(priv->pdev, dma_addr))
return -ENOMEM;
if (pci_dma_mapping_error(priv->pdev, dma_addr)) {
rc = -ENOMEM;
goto exit;
}

priv->hostcmd_wait = &cmd_wait;
iowrite32(dma_addr, regs + MWL8K_HIU_GEN_PTR);
Expand Down Expand Up @@ -2275,6 +2277,7 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd)
ms);
}

exit:
if (bitmap)
mwl8k_enable_bsses(hw, true, bitmap);

Expand Down

0 comments on commit d171728

Please sign in to comment.