fix mwifiex_pcie hotplug crash issue
PATCH 3/4 mwifiex: Do not kfree cmd buf while unregistering PCIe
In reply to Bing ZhaoFrom: Yogesh Ashok Powar <[email protected]>
All the command buffers are freed in mwifiex_free_cmd_buffer() and hence there is no need to kfree the current command buffer again. This might ends up freeing memory allocated by some other kernel code.
--- drivers/net/wireless/mwifiex/pcie.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/net/wireless/mwifiex/pcie.c +0 -1
@@ -863,7 +863,6 @@ static int mwifiex_pcie_delete_cmdrsp_buf(struct mwifiex_adapter *adapter)MWIFIEX_SKB_PACB (card->cmd_buf, &buf_pa);pci_unmap_single (card->dev, buf_pa,MWIFIEX_SIZE_OF_CMD_BUFFER ,PCI_DMA_TODEVICE ); -dev_kfree_skb_any (card->cmd_buf); }return 0 ; }
Signature · 1 line
1.7.0.2
cover fix mwifiex_pcie hotplug crash issue
The patch series fixes the crash while testing hotplug with an 8897 card. They are intended for wireless.git tree. Thanks!
Yogesh Ashok Powar (4):
mwifiex: Use pci_release_region() instead of a pci_release_regions()
mwifiex: Call pci_release_region after calling pci_disable_device
mwifiex: Do not kfree cmd buf while unregistering PCIe
mwifiex: Correct pci_unmap_single's size
drivers/net/wireless/mwifiex/pcie.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
PATCH 2/4 mwifiex: Call pci_release_region after calling pci_disable_device
From: Yogesh Ashok Powar <[email protected]>
"drivers should call pci_release_region() AFTER calling pci_disable_device()"
Please refer section 3.2 Request MMIO/IOP resources in Documentation/PCI/pci.txt
--- drivers/net/wireless/mwifiex/pcie.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/mwifiex/pcie.c +1 -1
@@ -2294,9 +2294,9 @@ static void mwifiex_pcie_cleanup(struct mwifiex_adapter *adapter)if (pdev) {pci_iounmap (pdev, card->pci_mmap);pci_iounmap (pdev, card->pci_mmap1); +pci_disable_device (pdev);pci_release_region (pdev,2 );pci_release_region (pdev,0 ); -pci_disable_device (pdev);pci_set_drvdata (pdev,NULL ); } }
Signature · 1 line
1.7.0.2
PATCH 1/4 mwifiex: Use pci_release_region() instead of a pci_release_regions()
In reply to Bing ZhaoFrom: Yogesh Ashok Powar <[email protected]>
PCI regions are associated with the device using pci_request_region() call. Hence use pci_release_region() instead of pci_release_regions().
--- drivers/net/wireless/mwifiex/pcie.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mwifiex/pcie.c +2 -2
@@ -2294,8 +2294,8 @@ static void mwifiex_pcie_cleanup(struct mwifiex_adapter *adapter)if (pdev) {pci_iounmap (pdev, card->pci_mmap);pci_iounmap (pdev, card->pci_mmap1); - -pci_release_regions (pdev); +pci_release_region (pdev,2 ); +pci_release_region (pdev,0 );pci_disable_device (pdev);pci_set_drvdata (pdev,NULL ); }
Signature · 1 line
1.7.0.2
PATCH 4/4 mwifiex: Correct pci_unmap_single's size
In reply to Bing ZhaoFrom: Yogesh Ashok Powar <[email protected]>
There exist mismatch between the size used for pci_map and pci_unmap on command skb. Correcting it.
--- drivers/net/wireless/mwifiex/pcie.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mwifiex/pcie.c +2 -2
@@ -861,7 +861,7 @@ static int mwifiex_pcie_delete_cmdrsp_buf(struct mwifiex_adapter *adapter)if (card && card->cmd_buf) {MWIFIEX_SKB_PACB (card->cmd_buf, &buf_pa); -pci_unmap_single (card->dev, buf_pa,MWIFIEX_SIZE_OF_CMD_BUFFER , +pci_unmap_single (card->dev, buf_pa, card->cmd_buf->len,PCI_DMA_TODEVICE ); }return 0 ;
@@ -1572,7 +1572,7 @@ static int mwifiex_pcie_cmdrsp_complete(struct mwifiex_adapter *adapter, skb_tmp = card->cmd_buf;if (skb_tmp) {MWIFIEX_SKB_PACB (skb_tmp, &buf_pa); -pci_unmap_single (card->dev, buf_pa,MWIFIEX_UPLD_SIZE , +pci_unmap_single (card->dev, buf_pa, skb_tmp->len,PCI_DMA_FROMDEVICE ); card->cmd_buf =NULL ; }
Signature · 1 line
1.7.0.2