wifi: mac80211: mesh: free pending CSA settings on interface stop
PATCH v2 1/1 wifi: mac80211: mesh: free pending CSA settings on interface stop
ifmsh->csa is allocated in ieee80211_mesh_csa_beacon() and normally freed in ieee80211_mesh_finish_csa() once the channel switch completes. If the mesh interface is stopped while a channel switch is still in progress, ifmsh->csa is never freed, leaking the mesh_csa_settings object.
Free it in ieee80211_stop_mesh(), the same way ifmsh->beacon is already handled there.
---
v2: drop unnecessary NULL check around csa, kfree_rcu() already
handles a NULL pointer (Nicolas Escande)
--- net/mac80211/mesh.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/mac80211/mesh.c +6 -0
@@ -1201,6 +1201,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)struct ieee80211_local *local = sdata->local;struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;struct beacon_data *bcn; +struct mesh_csa_settings *csa;netif_carrier_off (sdata->dev);
@@ -1222,6 +1223,11 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)RCU_INIT_POINTER (ifmsh->beacon,NULL );kfree_rcu (bcn, rcu_head); +/* free any pending, unfinished channel switch */ + csa =sdata_dereference (ifmsh->csa, sdata); +RCU_INIT_POINTER (ifmsh->csa,NULL ); +kfree_rcu (csa, rcu_head); +/* free all potentially still buffered group-addressed frames */ local->total_ps_buffered -=skb_queue_len (&ifmsh->ps.bc_buf);skb_queue_purge (&ifmsh->ps.bc_buf);
Signature · 1 line
2.34.1
Quoted 34 lines · Deepanshu Kartikey
ifmsh->csais allocated inieee80211_mesh_csa_beacon()and normally freed inieee80211_mesh_finish_csa()once the channel switch completes. If the mesh interface is stopped while a channel switch is still in progress,ifmsh->csais never freed, leaking themesh_csa_settingsobject.Free it in
ieee80211_stop_mesh(), the same wayifmsh->beaconis already handled there.Reported-by [email protected]Signed-off-by Deepanshu Kartikey <[email protected]>---
v2: drop unnecessary NULL check around csa,kfree_rcu()already
handles a NULL pointer (Nicolas Escande)--- net/mac80211/mesh.c | 6 ++++++ 1 file changed, 6 insertions(+)net/mac80211/mesh.c +1
-0@@ -1201,6 +1201,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)struct ieee80211_local *local = sdata->local;struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;struct beacon_data *bcn; +struct mesh_csa_settings *csa;netif_carrier_off (sdata->dev);@@ -1222,6 +1223,11 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)RCU_INIT_POINTER (ifmsh->beacon,NULL );
net/mac80211/mesh.c void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) · line 1233
Quoted 10 lines
net/mac80211/mesh.c +5
-0kfree_rcu (bcn, rcu_head); +/* free any pending, unfinished channel switch */ + csa =sdata_dereference (ifmsh->csa, sdata); +RCU_INIT_POINTER (ifmsh->csa,NULL ); +kfree_rcu (csa, rcu_head); +/* free all potentially still buffered group-addressed frames */ local->total_ps_buffered -=skb_queue_len (&ifmsh->ps.bc_buf);skb_queue_purge (&ifmsh->ps.bc_buf);
Quoted 46 lines · Deepanshu Kartikey
ifmsh->csais allocated inieee80211_mesh_csa_beacon()and normally freed inieee80211_mesh_finish_csa()once the channel switch completes. If the mesh interface is stopped while a channel switch is still in progress,ifmsh->csais never freed, leaking themesh_csa_settingsobject.Free it in
ieee80211_stop_mesh(), the same wayifmsh->beaconis already handled there.Reported-by [email protected]Signed-off-by Deepanshu Kartikey <[email protected]>---
v2: drop unnecessary NULL check around csa,kfree_rcu()already
handles a NULL pointer (Nicolas Escande)--- net/mac80211/mesh.c | 6 ++++++ 1 file changed, 6 insertions(+)net/mac80211/mesh.c +6
-1@@ -1201,6 +1201,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)struct ieee80211_local *local = sdata->local;struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;struct beacon_data *bcn; +struct mesh_csa_settings *csa;netif_carrier_off (sdata->dev);@@ -1222,6 +1223,11 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)RCU_INIT_POINTER (ifmsh->beacon,NULL );kfree_rcu (bcn, rcu_head); +/* free any pending, unfinished channel switch */ + csa =sdata_dereference (ifmsh->csa, sdata); +RCU_INIT_POINTER (ifmsh->csa,NULL ); +kfree_rcu (csa, rcu_head); +/* free all potentially still buffered group-addressed frames */ local->total_ps_buffered -=skb_queue_len (&ifmsh->ps.bc_buf);skb_queue_purge (&ifmsh->ps.bc_buf); --
Quoted 2 lines
2.34.1
Gentle Reminder. Please let me know the status of this patch.
Thanks
Deepanshu
Quoted 46 lines · Deepanshu Kartikey
ifmsh->csais allocated inieee80211_mesh_csa_beacon()and normally freed inieee80211_mesh_finish_csa()once the channel switch completes. If the mesh interface is stopped while a channel switch is still in progress,ifmsh->csais never freed, leaking themesh_csa_settingsobject.Free it in
ieee80211_stop_mesh(), the same wayifmsh->beaconis already handled there.Reported-by [email protected]Signed-off-by Deepanshu Kartikey <[email protected]>---
v2: drop unnecessary NULL check around csa,kfree_rcu()already
handles a NULL pointer (Nicolas Escande)--- net/mac80211/mesh.c | 6 ++++++ 1 file changed, 6 insertions(+)net/mac80211/mesh.c +6
-1@@ -1201,6 +1201,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)struct ieee80211_local *local = sdata->local;struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;struct beacon_data *bcn; +struct mesh_csa_settings *csa;netif_carrier_off (sdata->dev);@@ -1222,6 +1223,11 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)RCU_INIT_POINTER (ifmsh->beacon,NULL );kfree_rcu (bcn, rcu_head); +/* free any pending, unfinished channel switch */ + csa =sdata_dereference (ifmsh->csa, sdata); +RCU_INIT_POINTER (ifmsh->csa,NULL ); +kfree_rcu (csa, rcu_head); +/* free all potentially still buffered group-addressed frames */ local->total_ps_buffered -=skb_queue_len (&ifmsh->ps.bc_buf);skb_queue_purge (&ifmsh->ps.bc_buf); --
Quoted 2 lines
2.34.1
Gentle Reminder. Please let me know the status of this patch.
Thanks
Deepanshu
Quoted 46 lines · Deepanshu Kartikey
ifmsh->csais allocated inieee80211_mesh_csa_beacon()and normally freed inieee80211_mesh_finish_csa()once the channel switch completes. If the mesh interface is stopped while a channel switch is still in progress,ifmsh->csais never freed, leaking themesh_csa_settingsobject.Free it in
ieee80211_stop_mesh(), the same wayifmsh->beaconis already handled there.Reported-by [email protected]Signed-off-by Deepanshu Kartikey <[email protected]>---
v2: drop unnecessary NULL check around csa,kfree_rcu()already
handles a NULL pointer (Nicolas Escande)--- net/mac80211/mesh.c | 6 ++++++ 1 file changed, 6 insertions(+)net/mac80211/mesh.c +6
-1@@ -1201,6 +1201,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)struct ieee80211_local *local = sdata->local;struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;struct beacon_data *bcn; +struct mesh_csa_settings *csa;netif_carrier_off (sdata->dev);@@ -1222,6 +1223,11 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)RCU_INIT_POINTER (ifmsh->beacon,NULL );kfree_rcu (bcn, rcu_head); +/* free any pending, unfinished channel switch */ + csa =sdata_dereference (ifmsh->csa, sdata); +RCU_INIT_POINTER (ifmsh->csa,NULL ); +kfree_rcu (csa, rcu_head); +/* free all potentially still buffered group-addressed frames */ local->total_ps_buffered -=skb_queue_len (&ifmsh->ps.bc_buf);skb_queue_purge (&ifmsh->ps.bc_buf); --
Quoted 2 lines
2.34.1
Gentle Reminder. Please let me know the status of this patch.
Thanks
Deepanshu