|
101 | 101 | #define BRCMF_ASSOC_PARAMS_FIXED_SIZE \
|
102 | 102 | (sizeof(struct brcmf_assoc_params_le) - sizeof(u16))
|
103 | 103 |
|
| 104 | +#define BRCMF_MAX_CHANSPEC_LIST \ |
| 105 | + (BRCMF_DCMD_MEDLEN / sizeof(__le32) - 1) |
| 106 | + |
104 | 107 | struct brcmf_dump_survey {
|
105 | 108 | u32 obss;
|
106 | 109 | u32 ibss;
|
@@ -6840,6 +6843,13 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
|
6840 | 6843 | band->channels[i].flags = IEEE80211_CHAN_DISABLED;
|
6841 | 6844 |
|
6842 | 6845 | total = le32_to_cpu(list->count);
|
| 6846 | + if (total > BRCMF_MAX_CHANSPEC_LIST) { |
| 6847 | + bphy_err(drvr, "Invalid count of channel Spec. (%u)\n", |
| 6848 | + total); |
| 6849 | + err = -EINVAL; |
| 6850 | + goto fail_pbuf; |
| 6851 | + } |
| 6852 | + |
6843 | 6853 | for (i = 0; i < total; i++) {
|
6844 | 6854 | ch.chspec = (u16)le32_to_cpu(list->element[i]);
|
6845 | 6855 | cfg->d11inf.decchspec(&ch);
|
@@ -6985,6 +6995,13 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
|
6985 | 6995 | band = cfg_to_wiphy(cfg)->bands[NL80211_BAND_2GHZ];
|
6986 | 6996 | list = (struct brcmf_chanspec_list *)pbuf;
|
6987 | 6997 | num_chan = le32_to_cpu(list->count);
|
| 6998 | + if (num_chan > BRCMF_MAX_CHANSPEC_LIST) { |
| 6999 | + bphy_err(drvr, "Invalid count of channel Spec. (%u)\n", |
| 7000 | + num_chan); |
| 7001 | + kfree(pbuf); |
| 7002 | + return -EINVAL; |
| 7003 | + } |
| 7004 | + |
6988 | 7005 | for (i = 0; i < num_chan; i++) {
|
6989 | 7006 | ch.chspec = (u16)le32_to_cpu(list->element[i]);
|
6990 | 7007 | cfg->d11inf.decchspec(&ch);
|
|
0 commit comments