Skip to content

Commit 8fcfdea

Browse files
Vladimir Kondratievlinvjw
authored andcommitted
wil6210: fix free'd memory access in wil_if_free()
In the wil_priv_deinit(), wdev->netdev is accessed, so free_netdev() should not be called before mentioned call. Set wdev->netdev to NULL Make sure no more attempts to use it. It is used for debug printk if not NULL. This fix kernel panic on module unload and in case error on probe; if memory allocation debugging enabled. Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 1eb9d1e commit 8fcfdea

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • drivers/net/wireless/ath/wil6210

‎drivers/net/wireless/ath/wil6210/netdev.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,15 @@ void *wil_if_alloc(struct device *dev, void __iomem *csr)
168168
void wil_if_free(struct wil6210_priv *wil)
169169
{
170170
struct net_device *ndev = wil_to_ndev(wil);
171+
171172
if (!ndev)
172173
return;
173174

174-
free_netdev(ndev);
175175
wil_priv_deinit(wil);
176+
177+
wil_to_ndev(wil) = NULL;
178+
free_netdev(ndev);
179+
176180
wil_wdev_free(wil);
177181
}
178182

0 commit comments

Comments
 (0)