Search Linux Wireless

Re: [PATCH 1/2] nl80211: FILS discovery/bcast probe resp support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Aloka,

url:    https://github.com/0day-ci/linux/commits/Aloka-Dixit/FILS-discovery-and-bcast-probe-resp-support/20200523-062228
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master

config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

New smatch warnings:
net/wireless/nl80211.c:4771 nl80211_parse_fd_bcastpresp() error: we previously assumed 'tmpl' could be null (see line 4766)

# https://github.com/0day-ci/linux/commit/d7497e63c41decf82e86f11b0691e47e24b11122
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d7497e63c41decf82e86f11b0691e47e24b11122
vim +/tmpl +4771 net/wireless/nl80211.c

d7497e63c41dec Aloka Dixit  2020-05-22  4738  static int nl80211_parse_fd_bcastpresp(struct genl_info *info,
d7497e63c41dec Aloka Dixit  2020-05-22  4739  				       struct cfg80211_ap_settings *params)
d7497e63c41dec Aloka Dixit  2020-05-22  4740  {
d7497e63c41dec Aloka Dixit  2020-05-22  4741  	struct nlattr *tmpl;
d7497e63c41dec Aloka Dixit  2020-05-22  4742  	struct nlattr *tb[NL80211_FD_BCASTPRESP_ATTR_MAX + 1];
d7497e63c41dec Aloka Dixit  2020-05-22  4743  	int ret;
d7497e63c41dec Aloka Dixit  2020-05-22  4744  	struct cfg80211_beacon_data *beacon = &params->beacon;
d7497e63c41dec Aloka Dixit  2020-05-22  4745  	struct cfg80211_fd_bcastpresp *cfg;
d7497e63c41dec Aloka Dixit  2020-05-22  4746  
d7497e63c41dec Aloka Dixit  2020-05-22  4747  	if (params->chandef.center_freq1 <= 5940 &&
d7497e63c41dec Aloka Dixit  2020-05-22  4748  	    params->chandef.center_freq1 >= 7105)
d7497e63c41dec Aloka Dixit  2020-05-22  4749  		return -EOPNOTSUPP;
d7497e63c41dec Aloka Dixit  2020-05-22  4750  
d7497e63c41dec Aloka Dixit  2020-05-22  4751  	ret = nla_parse_nested(tb, NL80211_FD_BCASTPRESP_ATTR_MAX,
d7497e63c41dec Aloka Dixit  2020-05-22  4752  			       info->attrs[NL80211_ATTR_FD_BCASTPRESP_CFG],
d7497e63c41dec Aloka Dixit  2020-05-22  4753  			       fd_bcastpresp_policy, NULL);
d7497e63c41dec Aloka Dixit  2020-05-22  4754  	if (ret)
d7497e63c41dec Aloka Dixit  2020-05-22  4755  		return ret;
d7497e63c41dec Aloka Dixit  2020-05-22  4756  
d7497e63c41dec Aloka Dixit  2020-05-22  4757  	if (!tb[NL80211_FD_BCASTPRESP_ATTR_TYPE] ||
d7497e63c41dec Aloka Dixit  2020-05-22  4758  	    !tb[NL80211_FD_BCASTPRESP_ATTR_INT])
d7497e63c41dec Aloka Dixit  2020-05-22  4759  		return -EINVAL;
d7497e63c41dec Aloka Dixit  2020-05-22  4760  
d7497e63c41dec Aloka Dixit  2020-05-22  4761  	cfg = &params->fd_bcastpresp;
d7497e63c41dec Aloka Dixit  2020-05-22  4762  	cfg->type = nla_get_u8(tb[NL80211_FD_BCASTPRESP_ATTR_TYPE]);
d7497e63c41dec Aloka Dixit  2020-05-22  4763  	cfg->interval = nla_get_u32(tb[NL80211_FD_BCASTPRESP_ATTR_INT]);
d7497e63c41dec Aloka Dixit  2020-05-22  4764  
d7497e63c41dec Aloka Dixit  2020-05-22  4765  	tmpl = tb[NL80211_FD_BCASTPRESP_ATTR_TMPL];
d7497e63c41dec Aloka Dixit  2020-05-22 @4766  	if (!tmpl && !beacon->fils_disc_len && !beacon->bcast_presp_len)

Should the && be ||?

d7497e63c41dec Aloka Dixit  2020-05-22  4767  		return -EINVAL;
d7497e63c41dec Aloka Dixit  2020-05-22  4768  
d7497e63c41dec Aloka Dixit  2020-05-22  4769  	if (cfg->type == CFG80211_TYPE_FILS_DISCOVERY) {
d7497e63c41dec Aloka Dixit  2020-05-22  4770  		beacon->fils_disc = nla_data(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22 @4771  		beacon->fils_disc_len = nla_len(tmpl);
                                                                                        ^^^^
Unchecked dereference.

d7497e63c41dec Aloka Dixit  2020-05-22  4772  	} else if (cfg->type == CFG80211_TYPE_BCAST_PROBE_RESP) {
d7497e63c41dec Aloka Dixit  2020-05-22  4773  		beacon->bcast_presp = nla_data(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22  4774  		beacon->bcast_presp_len = nla_len(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22  4775  	}
d7497e63c41dec Aloka Dixit  2020-05-22  4776  
d7497e63c41dec Aloka Dixit  2020-05-22  4777  	return 0;
d7497e63c41dec Aloka Dixit  2020-05-22  4778  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux