* [PATCH] iwlwifi: Read outside array bounds @ 2009-07-25 21:34 Roel Kluin 2009-07-27 1:41 ` Zhu Yi 0 siblings, 1 reply; 7+ messages in thread From: Roel Kluin @ 2009-07-25 21:34 UTC (permalink / raw) To: yi.zhu, linux-wireless, ipw3945-devel, Andrew Morton tid is bounded (above) by the size of default_tid_to_tx_fifo (17 elements), but the size of priv->stations[].tid[] is MAX_TID_COUNT (9) elements. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> --- diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 85ae7a6..e9441c6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c @@ -1170,6 +1170,8 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) IWL_ERR(priv, "Start AGG on invalid station "); return -ENXIO; } + if (unlikely(tid >= MAX_TID_COUNT)) + return -EINVAL; if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) { IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF ! "); ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] iwlwifi: Read outside array bounds 2009-07-25 21:34 [PATCH] iwlwifi: Read outside array bounds Roel Kluin @ 2009-07-27 1:41 ` Zhu Yi 2009-07-27 8:28 ` Winkler, Tomas 0 siblings, 1 reply; 7+ messages in thread From: Zhu Yi @ 2009-07-27 1:41 UTC (permalink / raw) To: Roel Kluin, Winkler, Tomas, Chatre, Reinette Cc: linux-wireless@vger.kernel.org, ipw3945-devel@lists.sourceforge.net, Andrew Morton On Sun, 2009-07-26 at 05:34 +0800, Roel Kluin wrote: > tid is bounded (above) by the size of default_tid_to_tx_fifo (17 elements), but > the size of priv->stations[].tid[] is MAX_TID_COUNT (9) elements. I think MAX_TID_COUNT should be defined as 16 or 17. Tomas? Thanks, -yi > Signed-off-by: Roel Kluin <roel.kluin@gmail.com> > --- > diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c > index 85ae7a6..e9441c6 100644 > --- a/drivers/net/wireless/iwlwifi/iwl-tx.c > +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c > @@ -1170,6 +1170,8 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) > IWL_ERR(priv, "Start AGG on invalid station > "); > return -ENXIO; > } > + if (unlikely(tid >= MAX_TID_COUNT)) > + return -EINVAL; > > if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) { > IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF ! > "); ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] iwlwifi: Read outside array bounds 2009-07-27 1:41 ` Zhu Yi @ 2009-07-27 8:28 ` Winkler, Tomas 2009-07-27 22:12 ` reinette chatre 0 siblings, 1 reply; 7+ messages in thread From: Winkler, Tomas @ 2009-07-27 8:28 UTC (permalink / raw) To: Zhu, Yi, Roel Kluin, Chatre, Reinette Cc: linux-wireless@vger.kernel.org, ipw3945-devel@lists.sourceforge.net, Andrew Morton > -----Original Message----- > From: Zhu, Yi > Sent: Monday, July 27, 2009 4:42 AM > To: Roel Kluin; Winkler, Tomas; Chatre, Reinette > Cc: linux-wireless@vger.kernel.org; ipw3945-devel@lists.sourceforge.net; > Andrew Morton > Subject: Re: [PATCH] iwlwifi: Read outside array bounds > > On Sun, 2009-07-26 at 05:34 +0800, Roel Kluin wrote: > > tid is bounded (above) by the size of default_tid_to_tx_fifo (17 > elements), but > > the size of priv->stations[].tid[] is MAX_TID_COUNT (9) elements. > > I think MAX_TID_COUNT should be defined as 16 or 17. Tomas? > In general it's 16. In practice we use only 8. Tomas > Thanks, > -yi > > > Signed-off-by: Roel Kluin <roel.kluin@gmail.com> > > --- > > diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c > b/drivers/net/wireless/iwlwifi/iwl-tx.c > > index 85ae7a6..e9441c6 100644 > > --- a/drivers/net/wireless/iwlwifi/iwl-tx.c > > +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c > > @@ -1170,6 +1170,8 @@ int iwl_tx_agg_start(struct iwl_priv *priv, > const u8 *ra, u16 tid, u16 *ssn) > > IWL_ERR(priv, "Start AGG on invalid station > > "); > > return -ENXIO; > > } > > + if (unlikely(tid >= MAX_TID_COUNT)) > > + return -EINVAL; > > > > if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) { > > IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF ! > > "); --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] iwlwifi: Read outside array bounds 2009-07-27 8:28 ` Winkler, Tomas @ 2009-07-27 22:12 ` reinette chatre 2009-07-28 2:27 ` Zhu Yi 0 siblings, 1 reply; 7+ messages in thread From: reinette chatre @ 2009-07-27 22:12 UTC (permalink / raw) To: Winkler, Tomas Cc: Zhu, Yi, Roel Kluin, linux-wireless@vger.kernel.org, ipw3945-devel@lists.sourceforge.net, Andrew Morton On Mon, 2009-07-27 at 01:28 -0700, Winkler, Tomas wrote: > > > -----Original Message----- > > From: Zhu, Yi > > Sent: Monday, July 27, 2009 4:42 AM > > To: Roel Kluin; Winkler, Tomas; Chatre, Reinette > > Cc: linux-wireless@vger.kernel.org; ipw3945-devel@lists.sourceforge.net; > > Andrew Morton > > Subject: Re: [PATCH] iwlwifi: Read outside array bounds > > > > On Sun, 2009-07-26 at 05:34 +0800, Roel Kluin wrote: > > > tid is bounded (above) by the size of default_tid_to_tx_fifo (17 > > elements), but > > > the size of priv->stations[].tid[] is MAX_TID_COUNT (9) elements. > > > > I think MAX_TID_COUNT should be defined as 16 or 17. Tomas? > > > > In general it's 16. In practice we use only 8. I think the above statement means that we are mostly using EDCA quality of service which only uses 8 tids. We do not currently use HCCA (and thus of course not the hybrid) which would cause more tids to be used. A closer look at this flow to this function shows: rs_tl_turn_on_agg ->rs_tl_turn_on_agg_for_tid -->ieee80211_start_tx_ba_session --->iwl_mac_ampdu_action ---->iwl_tx_agg_start >From what I can tell the tid is not modified from rs_tl_turn_on_agg to iwl_tx_agg_start and rs_tl_turn_on_agg will not call further with a value of tid larger than 7 due to its checking. I thus do not see that tid may be equal or larger than MAX_TID_COUNT at this point of checking. Even so, having this check will not do harm and will increase safety. This patch is already merged and that is ok, I just wanted to add this information to it. Reinette ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] iwlwifi: Read outside array bounds 2009-07-27 22:12 ` reinette chatre @ 2009-07-28 2:27 ` Zhu Yi 2009-07-28 4:50 ` reinette chatre 0 siblings, 1 reply; 7+ messages in thread From: Zhu Yi @ 2009-07-28 2:27 UTC (permalink / raw) To: Chatre, Reinette Cc: Winkler, Tomas, Roel Kluin, linux-wireless@vger.kernel.org, ipw3945-devel@lists.sourceforge.net, Andrew Morton On Tue, 2009-07-28 at 06:12 +0800, Chatre, Reinette wrote: > On Mon, 2009-07-27 at 01:28 -0700, Winkler, Tomas wrote: > > > > > -----Original Message----- > > > From: Zhu, Yi > > > Sent: Monday, July 27, 2009 4:42 AM > > > To: Roel Kluin; Winkler, Tomas; Chatre, Reinette > > > Cc: linux-wireless@vger.kernel.org; ipw3945-devel@lists.sourceforge.net; > > > Andrew Morton > > > Subject: Re: [PATCH] iwlwifi: Read outside array bounds > > > > > > On Sun, 2009-07-26 at 05:34 +0800, Roel Kluin wrote: > > > > tid is bounded (above) by the size of default_tid_to_tx_fifo (17 > > > elements), but > > > > the size of priv->stations[].tid[] is MAX_TID_COUNT (9) elements. > > > > > > I think MAX_TID_COUNT should be defined as 16 or 17. Tomas? > > > > > > > In general it's 16. In practice we use only 8. > > I think the above statement means that we are mostly using EDCA quality > of service which only uses 8 tids. We do not currently use HCCA (and > thus of course not the hybrid) which would cause more tids to be used. > > A closer look at this flow to this function shows: > rs_tl_turn_on_agg rs_tl_add_packet { ... u8 *qc = ieee80211_get_qos_ctl(hdr); tid = qc[0] & 0xf; ... tl = &lq_data->load[tid]; } This should be a problem. Thanks, -yi ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] iwlwifi: Read outside array bounds 2009-07-28 2:27 ` Zhu Yi @ 2009-07-28 4:50 ` reinette chatre 2009-07-28 5:17 ` Zhu Yi 0 siblings, 1 reply; 7+ messages in thread From: reinette chatre @ 2009-07-28 4:50 UTC (permalink / raw) To: Zhu, Yi Cc: Winkler, Tomas, Roel Kluin, linux-wireless@vger.kernel.org, ipw3945-devel@lists.sourceforge.net, Andrew Morton On Mon, 2009-07-27 at 19:27 -0700, Zhu, Yi wrote: > On Tue, 2009-07-28 at 06:12 +0800, Chatre, Reinette wrote: > > On Mon, 2009-07-27 at 01:28 -0700, Winkler, Tomas wrote: > > > > > > > -----Original Message----- > > > > From: Zhu, Yi > > > > Sent: Monday, July 27, 2009 4:42 AM > > > > To: Roel Kluin; Winkler, Tomas; Chatre, Reinette > > > > Cc: linux-wireless@vger.kernel.org; ipw3945-devel@lists.sourceforge.net; > > > > Andrew Morton > > > > Subject: Re: [PATCH] iwlwifi: Read outside array bounds > > > > > > > > On Sun, 2009-07-26 at 05:34 +0800, Roel Kluin wrote: > > > > > tid is bounded (above) by the size of default_tid_to_tx_fifo (17 > > > > elements), but > > > > > the size of priv->stations[].tid[] is MAX_TID_COUNT (9) elements. > > > > > > > > I think MAX_TID_COUNT should be defined as 16 or 17. Tomas? > > > > > > > > > > In general it's 16. In practice we use only 8. > > > > I think the above statement means that we are mostly using EDCA quality > > of service which only uses 8 tids. We do not currently use HCCA (and > > thus of course not the hybrid) which would cause more tids to be used. > > > > A closer look at this flow to this function shows: > > rs_tl_turn_on_agg > > rs_tl_add_packet > { > ... > u8 *qc = ieee80211_get_qos_ctl(hdr); > tid = qc[0] & 0xf; > ... > > tl = &lq_data->load[tid]; > } > > This should be a problem. Indeed. Are there any other cases like this that you can think of? It seems like we need Roel's fix for iwl_tx_agg_stop also. Reinette ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] iwlwifi: Read outside array bounds 2009-07-28 4:50 ` reinette chatre @ 2009-07-28 5:17 ` Zhu Yi 0 siblings, 0 replies; 7+ messages in thread From: Zhu Yi @ 2009-07-28 5:17 UTC (permalink / raw) To: Chatre, Reinette Cc: Winkler, Tomas, Roel Kluin, linux-wireless@vger.kernel.org, ipw3945-devel@lists.sourceforge.net, Andrew Morton On Tue, 2009-07-28 at 12:50 +0800, Chatre, Reinette wrote: > On Mon, 2009-07-27 at 19:27 -0700, Zhu, Yi wrote: > > On Tue, 2009-07-28 at 06:12 +0800, Chatre, Reinette wrote: > > > On Mon, 2009-07-27 at 01:28 -0700, Winkler, Tomas wrote: > > > > > > > > > -----Original Message----- > > > > > From: Zhu, Yi > > > > > Sent: Monday, July 27, 2009 4:42 AM > > > > > To: Roel Kluin; Winkler, Tomas; Chatre, Reinette > > > > > Cc: linux-wireless@vger.kernel.org; ipw3945-devel@lists.sourceforge.net; > > > > > Andrew Morton > > > > > Subject: Re: [PATCH] iwlwifi: Read outside array bounds > > > > > > > > > > On Sun, 2009-07-26 at 05:34 +0800, Roel Kluin wrote: > > > > > > tid is bounded (above) by the size of default_tid_to_tx_fifo (17 > > > > > elements), but > > > > > > the size of priv->stations[].tid[] is MAX_TID_COUNT (9) elements. > > > > > > > > > > I think MAX_TID_COUNT should be defined as 16 or 17. Tomas? > > > > > > > > > > > > > In general it's 16. In practice we use only 8. > > > > > > I think the above statement means that we are mostly using EDCA quality > > > of service which only uses 8 tids. We do not currently use HCCA (and > > > thus of course not the hybrid) which would cause more tids to be used. > > > > > > A closer look at this flow to this function shows: > > > rs_tl_turn_on_agg > > > > rs_tl_add_packet > > { > > ... > > u8 *qc = ieee80211_get_qos_ctl(hdr); > > tid = qc[0] & 0xf; > > ... > > > > tl = &lq_data->load[tid]; > > } > > > > This should be a problem. > > Indeed. Are there any other cases like this that you can think of? It > seems like we need Roel's fix for iwl_tx_agg_stop also. Yes. I think we can do an audit for all the ieee80211_ops callbacks with tid as a parameter. Because mac80211 use u16 for tid, but iwlwifi use u8 internally. Thanks, -yi ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-07-28 5:17 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-07-25 21:34 [PATCH] iwlwifi: Read outside array bounds Roel Kluin 2009-07-27 1:41 ` Zhu Yi 2009-07-27 8:28 ` Winkler, Tomas 2009-07-27 22:12 ` reinette chatre 2009-07-28 2:27 ` Zhu Yi 2009-07-28 4:50 ` reinette chatre 2009-07-28 5:17 ` Zhu Yi
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).