* [PATCH] mwl8k: fix error handling in mwl8k_post_cmd()
@ 2019-04-05 21:26 Alexey Khoroshilov
2019-04-25 16:52 ` Kalle Valo
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2019-04-05 21:26 UTC (permalink / raw)
To: Lennert Buytenhek, Kalle Valo
Cc: Alexey Khoroshilov, David S. Miller, linux-wireless, netdev,
linux-kernel, ldv-project
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 <khoroshilov@ispras.ru>
---
drivers/net/wireless/marvell/mwl8k.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwl8k.c b/drivers/net/wireless/marvell/mwl8k.c
index 8e4e9b6919e0..e0df51b62e97 100644
--- a/drivers/net/wireless/marvell/mwl8k.c
+++ b/drivers/net/wireless/marvell/mwl8k.c
@@ -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);
@@ -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);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mwl8k: fix error handling in mwl8k_post_cmd()
2019-04-05 21:26 [PATCH] mwl8k: fix error handling in mwl8k_post_cmd() Alexey Khoroshilov
@ 2019-04-25 16:52 ` Kalle Valo
0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2019-04-25 16:52 UTC (permalink / raw)
To: Alexey Khoroshilov
Cc: Lennert Buytenhek, Alexey Khoroshilov, David S. Miller,
linux-wireless, netdev, linux-kernel, ldv-project
Alexey Khoroshilov <khoroshilov@ispras.ru> wrote:
> 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 <khoroshilov@ispras.ru>
Patch applied to wireless-drivers-next.git, thanks.
d1717282afd5 mwl8k: fix error handling in mwl8k_post_cmd()
--
https://patchwork.kernel.org/patch/10887851/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-04-25 16:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-05 21:26 [PATCH] mwl8k: fix error handling in mwl8k_post_cmd() Alexey Khoroshilov
2019-04-25 16:52 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).