|
91 | 91 | #define BRCMF_ASSOC_PARAMS_FIXED_SIZE \
|
92 | 92 | (sizeof(struct brcmf_assoc_params_le) - sizeof(u16))
|
93 | 93 |
|
| 94 | +#define BRCMF_MAX_CHANSPEC_LIST \ |
| 95 | + (BRCMF_DCMD_MEDLEN / sizeof(__le32) - 1) |
| 96 | + |
94 | 97 | static bool check_vif_up(struct brcmf_cfg80211_vif *vif)
|
95 | 98 | {
|
96 | 99 | if (!test_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state)) {
|
@@ -6556,6 +6559,13 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
|
6556 | 6559 | band->channels[i].flags = IEEE80211_CHAN_DISABLED;
|
6557 | 6560 |
|
6558 | 6561 | total = le32_to_cpu(list->count);
|
| 6562 | + if (total > BRCMF_MAX_CHANSPEC_LIST) { |
| 6563 | + bphy_err(drvr, "Invalid count of channel Spec. (%u)\n", |
| 6564 | + total); |
| 6565 | + err = -EINVAL; |
| 6566 | + goto fail_pbuf; |
| 6567 | + } |
| 6568 | + |
6559 | 6569 | for (i = 0; i < total; i++) {
|
6560 | 6570 | ch.chspec = (u16)le32_to_cpu(list->element[i]);
|
6561 | 6571 | cfg->d11inf.decchspec(&ch);
|
@@ -6701,6 +6711,13 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
|
6701 | 6711 | band = cfg_to_wiphy(cfg)->bands[NL80211_BAND_2GHZ];
|
6702 | 6712 | list = (struct brcmf_chanspec_list *)pbuf;
|
6703 | 6713 | num_chan = le32_to_cpu(list->count);
|
| 6714 | + if (num_chan > BRCMF_MAX_CHANSPEC_LIST) { |
| 6715 | + bphy_err(drvr, "Invalid count of channel Spec. (%u)\n", |
| 6716 | + num_chan); |
| 6717 | + kfree(pbuf); |
| 6718 | + return -EINVAL; |
| 6719 | + } |
| 6720 | + |
6704 | 6721 | for (i = 0; i < num_chan; i++) {
|
6705 | 6722 | ch.chspec = (u16)le32_to_cpu(list->element[i]);
|
6706 | 6723 | cfg->d11inf.decchspec(&ch);
|
|
0 commit comments