In ieee80211_vif_use_reserved_context(), when we have an old context and the new context's replace_state is set to IEEE80211_CHANCTX_REPLACE_NONE, we free the old context in ieee80211_vif_use_reserved_reassign(). Therefore, we cannot check the old_ctx anymore, so we should set it to NULL after this point. However, since the new_ctx replace state is clearly not IEEE80211_CHANCTX_REPLACES_OTHER, we're not going to do anything else in this function and can just return to avoid accessing the freed old_ctx.
Unified · Split
| @@ -1749,12 +1749,9 @@ int ieee80211_vif_use_reserved_context(struct ieee80211_sub_if_data *sdata) · 1748 unmodified lines | |||
| 1749 | 1749 | ||
| 1750 | if (new_ctx->replace_state == IEEE80211_CHANCTX_REPLACE_NONE) { | 1750 | if (new_ctx->replace_state == IEEE80211_CHANCTX_REPLACE_NONE) { |
| 1751 | if (old_ctx) | 1751 | if (old_ctx) |
| 1752 | err = ieee80211_vif_use_reserved_reassign(sdata); | 1752 | return ieee80211_vif_use_reserved_reassign(sdata); |
| 1753 | else | ||
| 1754 | err = ieee80211_vif_use_reserved_assign(sdata); | ||
| 1755 | 1753 | ||
| 1756 | if (err) | 1754 | return ieee80211_vif_use_reserved_assign(sdata); |
| 1757 | return err; | ||
| 1758 | } | 1755 | } |
| 1759 | 1756 | ||
| 1760 | /* | 1757 | /* |