* [PATCH] mt76: fix potential NULL pointer dereference in mt76_stop_tx_queues [not found] ` <cover.1542384797.git.lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2018-11-16 16:19 ` Lorenzo Bianconi 2018-11-17 11:13 ` Kalle Valo [not found] ` <98cf4a8f8a7f7840803b91b7c9078d8b61febee9.1542384797.git.lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 0 siblings, 2 replies; 4+ messages in thread From: Lorenzo Bianconi @ 2018-11-16 16:19 UTC (permalink / raw) To: kvalo-sgV2jX0FEOL9JmXXK+q4OQ Cc: nbd-Vt+b4OUoWG0, linux-wireless-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA Starting from mac80211 commit adf8ed01e4fd ("mac80211: add an optional TXQ for other PS-buffered frames") and commit 0eeb2b674f05 ("mac80211: add an option for station management TXQ") a new per-sta queue has been introduced for bufferable management frames. sta->txq[IEEE80211_NUM_TIDS] is initialized just if the driver reports the following hw flags: - IEEE80211_HW_STA_MMPDU_TXQ - IEEE80211_HW_BUFF_MMPDU_TXQ This can produce a NULL pointer dereference in mt76_stop_tx_queues since mt76 iterates on all available sta tx queues assuming they are initialized by mac80211. This issue has been spotted analyzing the code (it has not triggered any crash yet) Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> --- This patch is for 4.20 --- drivers/net/wireless/mediatek/mt76/tx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c index 7cbce03aa65b..aa426b838ffa 100644 --- a/drivers/net/wireless/mediatek/mt76/tx.c +++ b/drivers/net/wireless/mediatek/mt76/tx.c @@ -400,7 +400,12 @@ void mt76_stop_tx_queues(struct mt76_dev *dev, struct ieee80211_sta *sta, for (i = 0; i < ARRAY_SIZE(sta->txq); i++) { struct ieee80211_txq *txq = sta->txq[i]; - struct mt76_txq *mtxq = (struct mt76_txq *) txq->drv_priv; + struct mt76_txq *mtxq; + + if (!txq) + continue; + + mtxq = (struct mt76_txq *)txq->drv_priv; spin_lock_bh(&mtxq->hwq->lock); mtxq->send_bar = mtxq->aggr && send_bar; -- 2.19.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mt76: fix potential NULL pointer dereference in mt76_stop_tx_queues 2018-11-16 16:19 ` [PATCH] mt76: fix potential NULL pointer dereference in mt76_stop_tx_queues Lorenzo Bianconi @ 2018-11-17 11:13 ` Kalle Valo 2018-11-17 17:46 ` Lorenzo Bianconi [not found] ` <98cf4a8f8a7f7840803b91b7c9078d8b61febee9.1542384797.git.lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 1 sibling, 1 reply; 4+ messages in thread From: Kalle Valo @ 2018-11-17 11:13 UTC (permalink / raw) To: Lorenzo Bianconi; +Cc: nbd, linux-wireless, netdev Lorenzo Bianconi <lorenzo.bianconi@redhat.com> writes: > Starting from mac80211 commit adf8ed01e4fd ("mac80211: add an optional > TXQ for other PS-buffered frames") and commit 0eeb2b674f05 ("mac80211: > add an option for station management TXQ") a new per-sta queue has been > introduced for bufferable management frames. > sta->txq[IEEE80211_NUM_TIDS] is initialized just if the driver reports > the following hw flags: > - IEEE80211_HW_STA_MMPDU_TXQ > - IEEE80211_HW_BUFF_MMPDU_TXQ > This can produce a NULL pointer dereference in mt76_stop_tx_queues > since mt76 iterates on all available sta tx queues assuming they are > initialized by mac80211. This issue has been spotted analyzing the code > (it has not triggered any crash yet) > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> A very good commit log, thanks for that! > This patch is for 4.20 Ok, I'll wait for review comments and then queue this for 4.20. BTW, it would make my patch sorting easier if you could add a release label in the subject: [PATCH 4.20] mt76: fix potential NULL pointer dereference in mt76_stop_tx_queues More info: https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#tree_labels -- Kalle Valo ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mt76: fix potential NULL pointer dereference in mt76_stop_tx_queues 2018-11-17 11:13 ` Kalle Valo @ 2018-11-17 17:46 ` Lorenzo Bianconi 0 siblings, 0 replies; 4+ messages in thread From: Lorenzo Bianconi @ 2018-11-17 17:46 UTC (permalink / raw) To: Kalle Valo; +Cc: Felix Fietkau, linux-wireless, Network Development > A very good commit log, thanks for that! > > > This patch is for 4.20 > > Ok, I'll wait for review comments and then queue this for 4.20. > > BTW, it would make my patch sorting easier if you could add a release > label in the subject: > > [PATCH 4.20] mt76: fix potential NULL pointer dereference in mt76_stop_tx_queues > > More info: > > https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#tree_labels Ack, will do next time :) Regards, Lorenzo > > -- > Kalle Valo ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <98cf4a8f8a7f7840803b91b7c9078d8b61febee9.1542384797.git.lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] mt76: fix potential NULL pointer dereference in mt76_stop_tx_queues [not found] ` <98cf4a8f8a7f7840803b91b7c9078d8b61febee9.1542384797.git.lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2018-12-13 14:20 ` Kalle Valo 0 siblings, 0 replies; 4+ messages in thread From: Kalle Valo @ 2018-12-13 14:20 UTC (permalink / raw) To: Lorenzo Bianconi Cc: nbd-Vt+b4OUoWG0, linux-wireless-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA Lorenzo Bianconi <lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote: > Starting from mac80211 commit adf8ed01e4fd ("mac80211: add an optional > TXQ for other PS-buffered frames") and commit 0eeb2b674f05 ("mac80211: > add an option for station management TXQ") a new per-sta queue has been > introduced for bufferable management frames. > sta->txq[IEEE80211_NUM_TIDS] is initialized just if the driver reports > the following hw flags: > - IEEE80211_HW_STA_MMPDU_TXQ > - IEEE80211_HW_BUFF_MMPDU_TXQ > This can produce a NULL pointer dereference in mt76_stop_tx_queues > since mt76 iterates on all available sta tx queues assuming they are > initialized by mac80211. This issue has been spotted analyzing the code > (it has not triggered any crash yet) > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Patch applied to wireless-drivers.git, thanks. 7c250f4612ae mt76: fix potential NULL pointer dereference in mt76_stop_tx_queues -- https://patchwork.kernel.org/patch/10686507/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-12-13 14:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1542384797.git.lorenzo.bianconi@redhat.com>
[not found] ` <cover.1542384797.git.lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-11-16 16:19 ` [PATCH] mt76: fix potential NULL pointer dereference in mt76_stop_tx_queues Lorenzo Bianconi
2018-11-17 11:13 ` Kalle Valo
2018-11-17 17:46 ` Lorenzo Bianconi
[not found] ` <98cf4a8f8a7f7840803b91b7c9078d8b61febee9.1542384797.git.lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-12-13 14:20 ` 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).