All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v8 1/4] nl80211: add basic multiple bssid support
Date: Tue, 09 Mar 2021 09:40:20 +0300	[thread overview]
Message-ID: <20210309064020.GJ2087@kadam> (raw)
In-Reply-To: <20210309035437.6131-2-alokad@codeaurora.org>

[-- Attachment #1: Type: text/plain, Size: 23220 bytes --]

Hi Aloka,

url:    https://github.com/0day-ci/linux/commits/Aloka-Dixit/Multiple-BSSID-support/20210309-115621
base:   38b5133ad607ecdcc8d24906d1ac9cc8df41acd5
config: x86_64-randconfig-m001-20210309 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/wireless/nl80211.c:5704 nl80211_start_ap() error: 'params.acl' dereferencing possible ERR_PTR()

vim +5704 net/wireless/nl80211.c

8860020e0be1f0 Johannes Berg             2012-02-13  5448  static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
8860020e0be1f0 Johannes Berg             2012-02-13  5449  {
8860020e0be1f0 Johannes Berg             2012-02-13  5450  	struct cfg80211_registered_device *rdev = info->user_ptr[0];
8860020e0be1f0 Johannes Berg             2012-02-13  5451  	struct net_device *dev = info->user_ptr[1];
8860020e0be1f0 Johannes Berg             2012-02-13  5452  	struct wireless_dev *wdev = dev->ieee80211_ptr;
8860020e0be1f0 Johannes Berg             2012-02-13  5453  	struct cfg80211_ap_settings params;
8860020e0be1f0 Johannes Berg             2012-02-13  5454  	int err;
8860020e0be1f0 Johannes Berg             2012-02-13  5455  
074ac8df9f93f2 Johannes Berg             2010-09-16  5456  	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
4c476991062a0a Johannes Berg             2010-10-04  5457  	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
4c476991062a0a Johannes Berg             2010-10-04  5458  		return -EOPNOTSUPP;
eec60b037a8755 Jouni Malinen             2009-03-20  5459  
8860020e0be1f0 Johannes Berg             2012-02-13  5460  	if (!rdev->ops->start_ap)
8860020e0be1f0 Johannes Berg             2012-02-13  5461  		return -EOPNOTSUPP;
8860020e0be1f0 Johannes Berg             2012-02-13  5462  
8860020e0be1f0 Johannes Berg             2012-02-13  5463  	if (wdev->beacon_interval)
8860020e0be1f0 Johannes Berg             2012-02-13  5464  		return -EALREADY;
8860020e0be1f0 Johannes Berg             2012-02-13  5465  
56d1893d94bc06 Johannes Berg             2011-05-09  5466  	memset(&params, 0, sizeof(params));
56d1893d94bc06 Johannes Berg             2011-05-09  5467  
8860020e0be1f0 Johannes Berg             2012-02-13  5468  	/* these are required for START_AP */
ed1b6cc7f80f83 Johannes Berg             2007-12-19  5469  	if (!info->attrs[NL80211_ATTR_BEACON_INTERVAL] ||
ed1b6cc7f80f83 Johannes Berg             2007-12-19  5470  	    !info->attrs[NL80211_ATTR_DTIM_PERIOD] ||
4c476991062a0a Johannes Berg             2010-10-04  5471  	    !info->attrs[NL80211_ATTR_BEACON_HEAD])
4c476991062a0a Johannes Berg             2010-10-04  5472  		return -EINVAL;
ed1b6cc7f80f83 Johannes Berg             2007-12-19  5473  
81e54d08d9d845 Pradeep Kumar Chitrapu    2018-09-20  5474  	err = nl80211_parse_beacon(rdev, info->attrs, &params.beacon);
8860020e0be1f0 Johannes Berg             2012-02-13  5475  	if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5476  		goto out;
8860020e0be1f0 Johannes Berg             2012-02-13  5477  
8860020e0be1f0 Johannes Berg             2012-02-13  5478  	params.beacon_interval =
56d1893d94bc06 Johannes Berg             2011-05-09  5479  		nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
56d1893d94bc06 Johannes Berg             2011-05-09  5480  	params.dtim_period =
56d1893d94bc06 Johannes Berg             2011-05-09  5481  		nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);
56d1893d94bc06 Johannes Berg             2011-05-09  5482  
0c317a02ca982c Purushottam Kushwaha      2016-10-12  5483  	err = cfg80211_validate_beacon_int(rdev, dev->ieee80211_ptr->iftype,
0c317a02ca982c Purushottam Kushwaha      2016-10-12  5484  					   params.beacon_interval);
56d1893d94bc06 Johannes Berg             2011-05-09  5485  	if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5486  		goto out;
56d1893d94bc06 Johannes Berg             2011-05-09  5487  
32e9de846be885 Jouni Malinen             2011-08-10  5488  	/*
8860020e0be1f0 Johannes Berg             2012-02-13  5489  	 * In theory, some of these attributes should be required here
8860020e0be1f0 Johannes Berg             2012-02-13  5490  	 * but since they were not used when the command was originally
8860020e0be1f0 Johannes Berg             2012-02-13  5491  	 * added, keep them optional for old user space programs to let
8860020e0be1f0 Johannes Berg             2012-02-13  5492  	 * them continue to work with drivers that do not need the
8860020e0be1f0 Johannes Berg             2012-02-13  5493  	 * additional information -- drivers must check!
32e9de846be885 Jouni Malinen             2011-08-10  5494  	 */
32e9de846be885 Jouni Malinen             2011-08-10  5495  	if (info->attrs[NL80211_ATTR_SSID]) {
32e9de846be885 Jouni Malinen             2011-08-10  5496  		params.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]);
32e9de846be885 Jouni Malinen             2011-08-10  5497  		params.ssid_len =
32e9de846be885 Jouni Malinen             2011-08-10  5498  			nla_len(info->attrs[NL80211_ATTR_SSID]);
1a41c96851bfa3 John Crispin              2021-03-08  5499  		if (params.ssid_len == 0) {
1a41c96851bfa3 John Crispin              2021-03-08  5500  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5501  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5502  		}
32e9de846be885 Jouni Malinen             2011-08-10  5503  	}
32e9de846be885 Jouni Malinen             2011-08-10  5504  
ab0d76f6823cc3 Johannes Berg             2018-10-02  5505  	if (info->attrs[NL80211_ATTR_HIDDEN_SSID])
32e9de846be885 Jouni Malinen             2011-08-10  5506  		params.hidden_ssid = nla_get_u32(
32e9de846be885 Jouni Malinen             2011-08-10  5507  			info->attrs[NL80211_ATTR_HIDDEN_SSID]);
32e9de846be885 Jouni Malinen             2011-08-10  5508  
5fb628e9105eef Jouni Malinen             2011-08-10  5509  	params.privacy = !!info->attrs[NL80211_ATTR_PRIVACY];
5fb628e9105eef Jouni Malinen             2011-08-10  5510  
5fb628e9105eef Jouni Malinen             2011-08-10  5511  	if (info->attrs[NL80211_ATTR_AUTH_TYPE]) {
5fb628e9105eef Jouni Malinen             2011-08-10  5512  		params.auth_type = nla_get_u32(
5fb628e9105eef Jouni Malinen             2011-08-10  5513  			info->attrs[NL80211_ATTR_AUTH_TYPE]);
e39e5b5e720676 Jouni Malinen             2012-09-30  5514  		if (!nl80211_valid_auth_type(rdev, params.auth_type,
1a41c96851bfa3 John Crispin              2021-03-08  5515  					     NL80211_CMD_START_AP)) {
1a41c96851bfa3 John Crispin              2021-03-08  5516  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5517  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5518  		}
5fb628e9105eef Jouni Malinen             2011-08-10  5519  	} else
5fb628e9105eef Jouni Malinen             2011-08-10  5520  		params.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
5fb628e9105eef Jouni Malinen             2011-08-10  5521  
5fb628e9105eef Jouni Malinen             2011-08-10  5522  	err = nl80211_crypto_settings(rdev, info, &params.crypto,
5fb628e9105eef Jouni Malinen             2011-08-10  5523  				      NL80211_MAX_NR_CIPHER_SUITES);
5fb628e9105eef Jouni Malinen             2011-08-10  5524  	if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5525  		goto out;
5fb628e9105eef Jouni Malinen             2011-08-10  5526  
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5527  	if (info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]) {
1a41c96851bfa3 John Crispin              2021-03-08  5528  		if (!(rdev->wiphy.features &
1a41c96851bfa3 John Crispin              2021-03-08  5529  		      NL80211_FEATURE_INACTIVITY_TIMER)) {
1a41c96851bfa3 John Crispin              2021-03-08  5530  			err = -EOPNOTSUPP;
1a41c96851bfa3 John Crispin              2021-03-08  5531  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5532  		}
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5533  		params.inactivity_timeout = nla_get_u16(
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5534  			info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]);
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5535  	}
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5536  
53cabad70ecf0c Johannes Berg             2012-11-14  5537  	if (info->attrs[NL80211_ATTR_P2P_CTWINDOW]) {
1a41c96851bfa3 John Crispin              2021-03-08  5538  		if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) {
1a41c96851bfa3 John Crispin              2021-03-08  5539  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5540  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5541  		}
53cabad70ecf0c Johannes Berg             2012-11-14  5542  		params.p2p_ctwindow =
53cabad70ecf0c Johannes Berg             2012-11-14  5543  			nla_get_u8(info->attrs[NL80211_ATTR_P2P_CTWINDOW]);
53cabad70ecf0c Johannes Berg             2012-11-14  5544  		if (params.p2p_ctwindow != 0 &&
1a41c96851bfa3 John Crispin              2021-03-08  5545  		    !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN)) {
1a41c96851bfa3 John Crispin              2021-03-08  5546  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5547  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5548  		}
53cabad70ecf0c Johannes Berg             2012-11-14  5549  	}
53cabad70ecf0c Johannes Berg             2012-11-14  5550  
53cabad70ecf0c Johannes Berg             2012-11-14  5551  	if (info->attrs[NL80211_ATTR_P2P_OPPPS]) {
53cabad70ecf0c Johannes Berg             2012-11-14  5552  		u8 tmp;
53cabad70ecf0c Johannes Berg             2012-11-14  5553  
1a41c96851bfa3 John Crispin              2021-03-08  5554  		if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) {
1a41c96851bfa3 John Crispin              2021-03-08  5555  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5556  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5557  		}
53cabad70ecf0c Johannes Berg             2012-11-14  5558  		tmp = nla_get_u8(info->attrs[NL80211_ATTR_P2P_OPPPS]);
53cabad70ecf0c Johannes Berg             2012-11-14  5559  		params.p2p_opp_ps = tmp;
53cabad70ecf0c Johannes Berg             2012-11-14  5560  		if (params.p2p_opp_ps != 0 &&
1a41c96851bfa3 John Crispin              2021-03-08  5561  		    !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS)) {
1a41c96851bfa3 John Crispin              2021-03-08  5562  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5563  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5564  		}
53cabad70ecf0c Johannes Berg             2012-11-14  5565  	}
53cabad70ecf0c Johannes Berg             2012-11-14  5566  
aa430da41019c1 Johannes Berg             2012-05-16  5567  	if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) {
683b6d3b31a519 Johannes Berg             2012-11-08  5568  		err = nl80211_parse_chandef(rdev, info, &params.chandef);
683b6d3b31a519 Johannes Berg             2012-11-08  5569  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5570  			goto out;
683b6d3b31a519 Johannes Berg             2012-11-08  5571  	} else if (wdev->preset_chandef.chan) {
683b6d3b31a519 Johannes Berg             2012-11-08  5572  		params.chandef = wdev->preset_chandef;
1a41c96851bfa3 John Crispin              2021-03-08  5573  	} else if (!nl80211_get_ap_channel(rdev, &params)) {
1a41c96851bfa3 John Crispin              2021-03-08  5574  		err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5575  		goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5576  	}
aa430da41019c1 Johannes Berg             2012-05-16  5577  
923b352f19d9ea Arik Nemtsov              2015-07-08  5578  	if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &params.chandef,
1a41c96851bfa3 John Crispin              2021-03-08  5579  					   wdev->iftype)) {
1a41c96851bfa3 John Crispin              2021-03-08  5580  		err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5581  		goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5582  	}
aa430da41019c1 Johannes Berg             2012-05-16  5583  
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5584  	if (info->attrs[NL80211_ATTR_TX_RATES]) {
9a5f6488623730 Tamizh Chelvam            2020-05-13  5585  		err = nl80211_parse_tx_bitrate_mask(info, info->attrs,
9a5f6488623730 Tamizh Chelvam            2020-05-13  5586  						    NL80211_ATTR_TX_RATES,
eb89a6a6b7a1af Miles Hu                  2020-08-04  5587  						    &params.beacon_rate,
857b34c4fb104c Rajkumar Manoharan        2020-10-16  5588  						    dev, false);
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5589  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5590  			goto out;
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5591  
8564e38206de2f Johannes Berg             2016-09-19  5592  		err = validate_beacon_tx_rate(rdev, params.chandef.chan->band,
8564e38206de2f Johannes Berg             2016-09-19  5593  					      &params.beacon_rate);
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5594  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5595  			goto out;
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5596  	}
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5597  
18998c381b19bf Eliad Peller              2014-09-10  5598  	if (info->attrs[NL80211_ATTR_SMPS_MODE]) {
18998c381b19bf Eliad Peller              2014-09-10  5599  		params.smps_mode =
18998c381b19bf Eliad Peller              2014-09-10  5600  			nla_get_u8(info->attrs[NL80211_ATTR_SMPS_MODE]);
18998c381b19bf Eliad Peller              2014-09-10  5601  		switch (params.smps_mode) {
18998c381b19bf Eliad Peller              2014-09-10  5602  		case NL80211_SMPS_OFF:
18998c381b19bf Eliad Peller              2014-09-10  5603  			break;
18998c381b19bf Eliad Peller              2014-09-10  5604  		case NL80211_SMPS_STATIC:
18998c381b19bf Eliad Peller              2014-09-10  5605  			if (!(rdev->wiphy.features &
1a41c96851bfa3 John Crispin              2021-03-08  5606  			      NL80211_FEATURE_STATIC_SMPS)) {
1a41c96851bfa3 John Crispin              2021-03-08  5607  				err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5608  				goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5609  			}
18998c381b19bf Eliad Peller              2014-09-10  5610  			break;
18998c381b19bf Eliad Peller              2014-09-10  5611  		case NL80211_SMPS_DYNAMIC:
18998c381b19bf Eliad Peller              2014-09-10  5612  			if (!(rdev->wiphy.features &
1a41c96851bfa3 John Crispin              2021-03-08  5613  			      NL80211_FEATURE_DYNAMIC_SMPS)) {
1a41c96851bfa3 John Crispin              2021-03-08  5614  				err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5615  				goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5616  			}
18998c381b19bf Eliad Peller              2014-09-10  5617  			break;
18998c381b19bf Eliad Peller              2014-09-10  5618  		default:
1a41c96851bfa3 John Crispin              2021-03-08  5619  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5620  			goto out;
18998c381b19bf Eliad Peller              2014-09-10  5621  		}
18998c381b19bf Eliad Peller              2014-09-10  5622  	} else {
18998c381b19bf Eliad Peller              2014-09-10  5623  		params.smps_mode = NL80211_SMPS_OFF;
18998c381b19bf Eliad Peller              2014-09-10  5624  	}
18998c381b19bf Eliad Peller              2014-09-10  5625  
6e8ef842223b90 Purushottam Kushwaha      2016-07-05  5626  	params.pbss = nla_get_flag(info->attrs[NL80211_ATTR_PBSS]);
1a41c96851bfa3 John Crispin              2021-03-08  5627  	if (params.pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ]) {
1a41c96851bfa3 John Crispin              2021-03-08  5628  		err = -EOPNOTSUPP;
1a41c96851bfa3 John Crispin              2021-03-08  5629  		goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5630  	}
6e8ef842223b90 Purushottam Kushwaha      2016-07-05  5631  
4baf6bea37247e Ola Olsson                2015-10-29  5632  	if (info->attrs[NL80211_ATTR_ACL_POLICY]) {
4baf6bea37247e Ola Olsson                2015-10-29  5633  		params.acl = parse_acl_data(&rdev->wiphy, info);
1a41c96851bfa3 John Crispin              2021-03-08  5634  		if (IS_ERR(params.acl)) {
1a41c96851bfa3 John Crispin              2021-03-08  5635  			err = PTR_ERR(params.acl);

params.acl is an error pointer.

1a41c96851bfa3 John Crispin              2021-03-08  5636  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5637  		}
4baf6bea37247e Ola Olsson                2015-10-29  5638  	}
4baf6bea37247e Ola Olsson                2015-10-29  5639  
a0de1ca383c77a John Crispin              2019-05-28  5640  	params.twt_responder =
a0de1ca383c77a John Crispin              2019-05-28  5641  		    nla_get_flag(info->attrs[NL80211_ATTR_TWT_RESPONDER]);
a0de1ca383c77a John Crispin              2019-05-28  5642  
796e90f42b7e52 John Crispin              2019-07-30  5643  	if (info->attrs[NL80211_ATTR_HE_OBSS_PD]) {
796e90f42b7e52 John Crispin              2019-07-30  5644  		err = nl80211_parse_he_obss_pd(
796e90f42b7e52 John Crispin              2019-07-30  5645  					info->attrs[NL80211_ATTR_HE_OBSS_PD],
796e90f42b7e52 John Crispin              2019-07-30  5646  					&params.he_obss_pd);
bc7a39b4272b96 Luca Coelho               2020-06-26  5647  		if (err)
9951ebfcdf2b97 Johannes Berg             2020-02-21  5648  			goto out;
796e90f42b7e52 John Crispin              2019-07-30  5649  	}
796e90f42b7e52 John Crispin              2019-07-30  5650  
5c5e52d1bb9625 John Crispin              2019-12-17  5651  	if (info->attrs[NL80211_ATTR_HE_BSS_COLOR]) {
5c5e52d1bb9625 John Crispin              2019-12-17  5652  		err = nl80211_parse_he_bss_color(
5c5e52d1bb9625 John Crispin              2019-12-17  5653  					info->attrs[NL80211_ATTR_HE_BSS_COLOR],
5c5e52d1bb9625 John Crispin              2019-12-17  5654  					&params.he_bss_color);
5c5e52d1bb9625 John Crispin              2019-12-17  5655  		if (err)
60a0121f8fa64b Luca Coelho               2020-06-26  5656  			goto out;
5c5e52d1bb9625 John Crispin              2019-12-17  5657  	}
5c5e52d1bb9625 John Crispin              2019-12-17  5658  
291c49ded2fda1 Aloka Dixit               2020-09-11  5659  	if (info->attrs[NL80211_ATTR_FILS_DISCOVERY]) {
291c49ded2fda1 Aloka Dixit               2020-09-11  5660  		err = nl80211_parse_fils_discovery(rdev,
291c49ded2fda1 Aloka Dixit               2020-09-11  5661  						   info->attrs[NL80211_ATTR_FILS_DISCOVERY],
291c49ded2fda1 Aloka Dixit               2020-09-11  5662  						   &params);
291c49ded2fda1 Aloka Dixit               2020-09-11  5663  		if (err)
291c49ded2fda1 Aloka Dixit               2020-09-11  5664  			goto out;
291c49ded2fda1 Aloka Dixit               2020-09-11  5665  	}
291c49ded2fda1 Aloka Dixit               2020-09-11  5666  
7443dcd1f1718a Aloka Dixit               2020-09-11  5667  	if (info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP]) {
7443dcd1f1718a Aloka Dixit               2020-09-11  5668  		err = nl80211_parse_unsol_bcast_probe_resp(
7443dcd1f1718a Aloka Dixit               2020-09-11  5669  			rdev, info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP],
7443dcd1f1718a Aloka Dixit               2020-09-11  5670  			&params);
7443dcd1f1718a Aloka Dixit               2020-09-11  5671  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5672  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5673  	}
1a41c96851bfa3 John Crispin              2021-03-08  5674  
1a41c96851bfa3 John Crispin              2021-03-08  5675  	if (info->attrs[NL80211_ATTR_MULTIPLE_BSSID_CONFIG]) {
1a41c96851bfa3 John Crispin              2021-03-08  5676  		err = nl80211_parse_multiple_bssid_config(
1a41c96851bfa3 John Crispin              2021-03-08  5677  			&rdev->wiphy,
1a41c96851bfa3 John Crispin              2021-03-08  5678  			info->attrs[NL80211_ATTR_MULTIPLE_BSSID_CONFIG],
1a41c96851bfa3 John Crispin              2021-03-08  5679  			&params);
1a41c96851bfa3 John Crispin              2021-03-08  5680  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5681  			goto out;
7443dcd1f1718a Aloka Dixit               2020-09-11  5682  	}
7443dcd1f1718a Aloka Dixit               2020-09-11  5683  
66cd794e3c30b8 Johannes Berg             2017-02-07  5684  	nl80211_calculate_ap_params(&params);
66cd794e3c30b8 Johannes Berg             2017-02-07  5685  
fe4943702c850f Srinivas Dasari           2019-01-23  5686  	if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])
fe4943702c850f Srinivas Dasari           2019-01-23  5687  		params.flags |= AP_SETTINGS_EXTERNAL_AUTH_SUPPORT;
fe4943702c850f Srinivas Dasari           2019-01-23  5688  
c56589ed1d25ae Simon Wunderlich          2013-11-21  5689  	wdev_lock(wdev);
e35e4d28b687d4 Hila Gonen                2012-06-27  5690  	err = rdev_start_ap(rdev, dev, &params);
46c1dd0c7fac54 Felix Fietkau             2012-06-19  5691  	if (!err) {
683b6d3b31a519 Johannes Berg             2012-11-08  5692  		wdev->preset_chandef = params.chandef;
8860020e0be1f0 Johannes Berg             2012-02-13  5693  		wdev->beacon_interval = params.beacon_interval;
9e0e29615a2077 Michal Kazior             2014-01-29  5694  		wdev->chandef = params.chandef;
06e191e22eb99c Antonio Quartulli         2012-11-07  5695  		wdev->ssid_len = params.ssid_len;
06e191e22eb99c Antonio Quartulli         2012-11-07  5696  		memcpy(wdev->ssid, params.ssid, wdev->ssid_len);
466a306142c002 Denis Kenzior             2018-03-26  5697  
466a306142c002 Denis Kenzior             2018-03-26  5698  		if (info->attrs[NL80211_ATTR_SOCKET_OWNER])
466a306142c002 Denis Kenzior             2018-03-26  5699  			wdev->conn_owner_nlportid = info->snd_portid;
46c1dd0c7fac54 Felix Fietkau             2012-06-19  5700  	}
c56589ed1d25ae Simon Wunderlich          2013-11-21  5701  	wdev_unlock(wdev);
77765eaf5cfb6b Vasanthakumar Thiagarajan 2013-01-18  5702  
9951ebfcdf2b97 Johannes Berg             2020-02-21  5703  out:
77765eaf5cfb6b Vasanthakumar Thiagarajan 2013-01-18 @5704  	kfree(params.acl);
                                                                      ^^^^^^^^^^
Dereferencing potential error pointer.  Freeing resources that weren't
allocated is one of the classic bugs with "out:" labels that free
everything.

1a41c96851bfa3 John Crispin              2021-03-08  5705  	kfree(params.beacon.multiple_bssid);
8860020e0be1f0 Johannes Berg             2012-02-13  5706  	return err;
ed1b6cc7f80f83 Johannes Berg             2007-12-19  5707  }

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41135 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Aloka Dixit <alokad@codeaurora.org>,
	johannes@sipsolutions.net
Cc: lkp@intel.com, kbuild-all@01.org, linux-wireless@vger.kernel.org,
	John Crispin <john@phrozen.org>,
	Aloka Dixit <alokad@codeaurora.org>
Subject: Re: [PATCH v8 1/4] nl80211: add basic multiple bssid support
Date: Tue, 9 Mar 2021 09:40:20 +0300	[thread overview]
Message-ID: <20210309064020.GJ2087@kadam> (raw)
In-Reply-To: <20210309035437.6131-2-alokad@codeaurora.org>

[-- Attachment #1: Type: text/plain, Size: 22930 bytes --]

Hi Aloka,

url:    https://github.com/0day-ci/linux/commits/Aloka-Dixit/Multiple-BSSID-support/20210309-115621
base:   38b5133ad607ecdcc8d24906d1ac9cc8df41acd5
config: x86_64-randconfig-m001-20210309 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/wireless/nl80211.c:5704 nl80211_start_ap() error: 'params.acl' dereferencing possible ERR_PTR()

vim +5704 net/wireless/nl80211.c

8860020e0be1f0 Johannes Berg             2012-02-13  5448  static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
8860020e0be1f0 Johannes Berg             2012-02-13  5449  {
8860020e0be1f0 Johannes Berg             2012-02-13  5450  	struct cfg80211_registered_device *rdev = info->user_ptr[0];
8860020e0be1f0 Johannes Berg             2012-02-13  5451  	struct net_device *dev = info->user_ptr[1];
8860020e0be1f0 Johannes Berg             2012-02-13  5452  	struct wireless_dev *wdev = dev->ieee80211_ptr;
8860020e0be1f0 Johannes Berg             2012-02-13  5453  	struct cfg80211_ap_settings params;
8860020e0be1f0 Johannes Berg             2012-02-13  5454  	int err;
8860020e0be1f0 Johannes Berg             2012-02-13  5455  
074ac8df9f93f2 Johannes Berg             2010-09-16  5456  	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
4c476991062a0a Johannes Berg             2010-10-04  5457  	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
4c476991062a0a Johannes Berg             2010-10-04  5458  		return -EOPNOTSUPP;
eec60b037a8755 Jouni Malinen             2009-03-20  5459  
8860020e0be1f0 Johannes Berg             2012-02-13  5460  	if (!rdev->ops->start_ap)
8860020e0be1f0 Johannes Berg             2012-02-13  5461  		return -EOPNOTSUPP;
8860020e0be1f0 Johannes Berg             2012-02-13  5462  
8860020e0be1f0 Johannes Berg             2012-02-13  5463  	if (wdev->beacon_interval)
8860020e0be1f0 Johannes Berg             2012-02-13  5464  		return -EALREADY;
8860020e0be1f0 Johannes Berg             2012-02-13  5465  
56d1893d94bc06 Johannes Berg             2011-05-09  5466  	memset(&params, 0, sizeof(params));
56d1893d94bc06 Johannes Berg             2011-05-09  5467  
8860020e0be1f0 Johannes Berg             2012-02-13  5468  	/* these are required for START_AP */
ed1b6cc7f80f83 Johannes Berg             2007-12-19  5469  	if (!info->attrs[NL80211_ATTR_BEACON_INTERVAL] ||
ed1b6cc7f80f83 Johannes Berg             2007-12-19  5470  	    !info->attrs[NL80211_ATTR_DTIM_PERIOD] ||
4c476991062a0a Johannes Berg             2010-10-04  5471  	    !info->attrs[NL80211_ATTR_BEACON_HEAD])
4c476991062a0a Johannes Berg             2010-10-04  5472  		return -EINVAL;
ed1b6cc7f80f83 Johannes Berg             2007-12-19  5473  
81e54d08d9d845 Pradeep Kumar Chitrapu    2018-09-20  5474  	err = nl80211_parse_beacon(rdev, info->attrs, &params.beacon);
8860020e0be1f0 Johannes Berg             2012-02-13  5475  	if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5476  		goto out;
8860020e0be1f0 Johannes Berg             2012-02-13  5477  
8860020e0be1f0 Johannes Berg             2012-02-13  5478  	params.beacon_interval =
56d1893d94bc06 Johannes Berg             2011-05-09  5479  		nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
56d1893d94bc06 Johannes Berg             2011-05-09  5480  	params.dtim_period =
56d1893d94bc06 Johannes Berg             2011-05-09  5481  		nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);
56d1893d94bc06 Johannes Berg             2011-05-09  5482  
0c317a02ca982c Purushottam Kushwaha      2016-10-12  5483  	err = cfg80211_validate_beacon_int(rdev, dev->ieee80211_ptr->iftype,
0c317a02ca982c Purushottam Kushwaha      2016-10-12  5484  					   params.beacon_interval);
56d1893d94bc06 Johannes Berg             2011-05-09  5485  	if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5486  		goto out;
56d1893d94bc06 Johannes Berg             2011-05-09  5487  
32e9de846be885 Jouni Malinen             2011-08-10  5488  	/*
8860020e0be1f0 Johannes Berg             2012-02-13  5489  	 * In theory, some of these attributes should be required here
8860020e0be1f0 Johannes Berg             2012-02-13  5490  	 * but since they were not used when the command was originally
8860020e0be1f0 Johannes Berg             2012-02-13  5491  	 * added, keep them optional for old user space programs to let
8860020e0be1f0 Johannes Berg             2012-02-13  5492  	 * them continue to work with drivers that do not need the
8860020e0be1f0 Johannes Berg             2012-02-13  5493  	 * additional information -- drivers must check!
32e9de846be885 Jouni Malinen             2011-08-10  5494  	 */
32e9de846be885 Jouni Malinen             2011-08-10  5495  	if (info->attrs[NL80211_ATTR_SSID]) {
32e9de846be885 Jouni Malinen             2011-08-10  5496  		params.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]);
32e9de846be885 Jouni Malinen             2011-08-10  5497  		params.ssid_len =
32e9de846be885 Jouni Malinen             2011-08-10  5498  			nla_len(info->attrs[NL80211_ATTR_SSID]);
1a41c96851bfa3 John Crispin              2021-03-08  5499  		if (params.ssid_len == 0) {
1a41c96851bfa3 John Crispin              2021-03-08  5500  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5501  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5502  		}
32e9de846be885 Jouni Malinen             2011-08-10  5503  	}
32e9de846be885 Jouni Malinen             2011-08-10  5504  
ab0d76f6823cc3 Johannes Berg             2018-10-02  5505  	if (info->attrs[NL80211_ATTR_HIDDEN_SSID])
32e9de846be885 Jouni Malinen             2011-08-10  5506  		params.hidden_ssid = nla_get_u32(
32e9de846be885 Jouni Malinen             2011-08-10  5507  			info->attrs[NL80211_ATTR_HIDDEN_SSID]);
32e9de846be885 Jouni Malinen             2011-08-10  5508  
5fb628e9105eef Jouni Malinen             2011-08-10  5509  	params.privacy = !!info->attrs[NL80211_ATTR_PRIVACY];
5fb628e9105eef Jouni Malinen             2011-08-10  5510  
5fb628e9105eef Jouni Malinen             2011-08-10  5511  	if (info->attrs[NL80211_ATTR_AUTH_TYPE]) {
5fb628e9105eef Jouni Malinen             2011-08-10  5512  		params.auth_type = nla_get_u32(
5fb628e9105eef Jouni Malinen             2011-08-10  5513  			info->attrs[NL80211_ATTR_AUTH_TYPE]);
e39e5b5e720676 Jouni Malinen             2012-09-30  5514  		if (!nl80211_valid_auth_type(rdev, params.auth_type,
1a41c96851bfa3 John Crispin              2021-03-08  5515  					     NL80211_CMD_START_AP)) {
1a41c96851bfa3 John Crispin              2021-03-08  5516  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5517  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5518  		}
5fb628e9105eef Jouni Malinen             2011-08-10  5519  	} else
5fb628e9105eef Jouni Malinen             2011-08-10  5520  		params.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
5fb628e9105eef Jouni Malinen             2011-08-10  5521  
5fb628e9105eef Jouni Malinen             2011-08-10  5522  	err = nl80211_crypto_settings(rdev, info, &params.crypto,
5fb628e9105eef Jouni Malinen             2011-08-10  5523  				      NL80211_MAX_NR_CIPHER_SUITES);
5fb628e9105eef Jouni Malinen             2011-08-10  5524  	if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5525  		goto out;
5fb628e9105eef Jouni Malinen             2011-08-10  5526  
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5527  	if (info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]) {
1a41c96851bfa3 John Crispin              2021-03-08  5528  		if (!(rdev->wiphy.features &
1a41c96851bfa3 John Crispin              2021-03-08  5529  		      NL80211_FEATURE_INACTIVITY_TIMER)) {
1a41c96851bfa3 John Crispin              2021-03-08  5530  			err = -EOPNOTSUPP;
1a41c96851bfa3 John Crispin              2021-03-08  5531  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5532  		}
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5533  		params.inactivity_timeout = nla_get_u16(
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5534  			info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]);
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5535  	}
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5536  
53cabad70ecf0c Johannes Berg             2012-11-14  5537  	if (info->attrs[NL80211_ATTR_P2P_CTWINDOW]) {
1a41c96851bfa3 John Crispin              2021-03-08  5538  		if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) {
1a41c96851bfa3 John Crispin              2021-03-08  5539  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5540  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5541  		}
53cabad70ecf0c Johannes Berg             2012-11-14  5542  		params.p2p_ctwindow =
53cabad70ecf0c Johannes Berg             2012-11-14  5543  			nla_get_u8(info->attrs[NL80211_ATTR_P2P_CTWINDOW]);
53cabad70ecf0c Johannes Berg             2012-11-14  5544  		if (params.p2p_ctwindow != 0 &&
1a41c96851bfa3 John Crispin              2021-03-08  5545  		    !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN)) {
1a41c96851bfa3 John Crispin              2021-03-08  5546  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5547  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5548  		}
53cabad70ecf0c Johannes Berg             2012-11-14  5549  	}
53cabad70ecf0c Johannes Berg             2012-11-14  5550  
53cabad70ecf0c Johannes Berg             2012-11-14  5551  	if (info->attrs[NL80211_ATTR_P2P_OPPPS]) {
53cabad70ecf0c Johannes Berg             2012-11-14  5552  		u8 tmp;
53cabad70ecf0c Johannes Berg             2012-11-14  5553  
1a41c96851bfa3 John Crispin              2021-03-08  5554  		if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) {
1a41c96851bfa3 John Crispin              2021-03-08  5555  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5556  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5557  		}
53cabad70ecf0c Johannes Berg             2012-11-14  5558  		tmp = nla_get_u8(info->attrs[NL80211_ATTR_P2P_OPPPS]);
53cabad70ecf0c Johannes Berg             2012-11-14  5559  		params.p2p_opp_ps = tmp;
53cabad70ecf0c Johannes Berg             2012-11-14  5560  		if (params.p2p_opp_ps != 0 &&
1a41c96851bfa3 John Crispin              2021-03-08  5561  		    !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS)) {
1a41c96851bfa3 John Crispin              2021-03-08  5562  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5563  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5564  		}
53cabad70ecf0c Johannes Berg             2012-11-14  5565  	}
53cabad70ecf0c Johannes Berg             2012-11-14  5566  
aa430da41019c1 Johannes Berg             2012-05-16  5567  	if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) {
683b6d3b31a519 Johannes Berg             2012-11-08  5568  		err = nl80211_parse_chandef(rdev, info, &params.chandef);
683b6d3b31a519 Johannes Berg             2012-11-08  5569  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5570  			goto out;
683b6d3b31a519 Johannes Berg             2012-11-08  5571  	} else if (wdev->preset_chandef.chan) {
683b6d3b31a519 Johannes Berg             2012-11-08  5572  		params.chandef = wdev->preset_chandef;
1a41c96851bfa3 John Crispin              2021-03-08  5573  	} else if (!nl80211_get_ap_channel(rdev, &params)) {
1a41c96851bfa3 John Crispin              2021-03-08  5574  		err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5575  		goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5576  	}
aa430da41019c1 Johannes Berg             2012-05-16  5577  
923b352f19d9ea Arik Nemtsov              2015-07-08  5578  	if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &params.chandef,
1a41c96851bfa3 John Crispin              2021-03-08  5579  					   wdev->iftype)) {
1a41c96851bfa3 John Crispin              2021-03-08  5580  		err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5581  		goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5582  	}
aa430da41019c1 Johannes Berg             2012-05-16  5583  
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5584  	if (info->attrs[NL80211_ATTR_TX_RATES]) {
9a5f6488623730 Tamizh Chelvam            2020-05-13  5585  		err = nl80211_parse_tx_bitrate_mask(info, info->attrs,
9a5f6488623730 Tamizh Chelvam            2020-05-13  5586  						    NL80211_ATTR_TX_RATES,
eb89a6a6b7a1af Miles Hu                  2020-08-04  5587  						    &params.beacon_rate,
857b34c4fb104c Rajkumar Manoharan        2020-10-16  5588  						    dev, false);
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5589  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5590  			goto out;
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5591  
8564e38206de2f Johannes Berg             2016-09-19  5592  		err = validate_beacon_tx_rate(rdev, params.chandef.chan->band,
8564e38206de2f Johannes Berg             2016-09-19  5593  					      &params.beacon_rate);
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5594  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5595  			goto out;
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5596  	}
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5597  
18998c381b19bf Eliad Peller              2014-09-10  5598  	if (info->attrs[NL80211_ATTR_SMPS_MODE]) {
18998c381b19bf Eliad Peller              2014-09-10  5599  		params.smps_mode =
18998c381b19bf Eliad Peller              2014-09-10  5600  			nla_get_u8(info->attrs[NL80211_ATTR_SMPS_MODE]);
18998c381b19bf Eliad Peller              2014-09-10  5601  		switch (params.smps_mode) {
18998c381b19bf Eliad Peller              2014-09-10  5602  		case NL80211_SMPS_OFF:
18998c381b19bf Eliad Peller              2014-09-10  5603  			break;
18998c381b19bf Eliad Peller              2014-09-10  5604  		case NL80211_SMPS_STATIC:
18998c381b19bf Eliad Peller              2014-09-10  5605  			if (!(rdev->wiphy.features &
1a41c96851bfa3 John Crispin              2021-03-08  5606  			      NL80211_FEATURE_STATIC_SMPS)) {
1a41c96851bfa3 John Crispin              2021-03-08  5607  				err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5608  				goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5609  			}
18998c381b19bf Eliad Peller              2014-09-10  5610  			break;
18998c381b19bf Eliad Peller              2014-09-10  5611  		case NL80211_SMPS_DYNAMIC:
18998c381b19bf Eliad Peller              2014-09-10  5612  			if (!(rdev->wiphy.features &
1a41c96851bfa3 John Crispin              2021-03-08  5613  			      NL80211_FEATURE_DYNAMIC_SMPS)) {
1a41c96851bfa3 John Crispin              2021-03-08  5614  				err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5615  				goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5616  			}
18998c381b19bf Eliad Peller              2014-09-10  5617  			break;
18998c381b19bf Eliad Peller              2014-09-10  5618  		default:
1a41c96851bfa3 John Crispin              2021-03-08  5619  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5620  			goto out;
18998c381b19bf Eliad Peller              2014-09-10  5621  		}
18998c381b19bf Eliad Peller              2014-09-10  5622  	} else {
18998c381b19bf Eliad Peller              2014-09-10  5623  		params.smps_mode = NL80211_SMPS_OFF;
18998c381b19bf Eliad Peller              2014-09-10  5624  	}
18998c381b19bf Eliad Peller              2014-09-10  5625  
6e8ef842223b90 Purushottam Kushwaha      2016-07-05  5626  	params.pbss = nla_get_flag(info->attrs[NL80211_ATTR_PBSS]);
1a41c96851bfa3 John Crispin              2021-03-08  5627  	if (params.pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ]) {
1a41c96851bfa3 John Crispin              2021-03-08  5628  		err = -EOPNOTSUPP;
1a41c96851bfa3 John Crispin              2021-03-08  5629  		goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5630  	}
6e8ef842223b90 Purushottam Kushwaha      2016-07-05  5631  
4baf6bea37247e Ola Olsson                2015-10-29  5632  	if (info->attrs[NL80211_ATTR_ACL_POLICY]) {
4baf6bea37247e Ola Olsson                2015-10-29  5633  		params.acl = parse_acl_data(&rdev->wiphy, info);
1a41c96851bfa3 John Crispin              2021-03-08  5634  		if (IS_ERR(params.acl)) {
1a41c96851bfa3 John Crispin              2021-03-08  5635  			err = PTR_ERR(params.acl);

params.acl is an error pointer.

1a41c96851bfa3 John Crispin              2021-03-08  5636  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5637  		}
4baf6bea37247e Ola Olsson                2015-10-29  5638  	}
4baf6bea37247e Ola Olsson                2015-10-29  5639  
a0de1ca383c77a John Crispin              2019-05-28  5640  	params.twt_responder =
a0de1ca383c77a John Crispin              2019-05-28  5641  		    nla_get_flag(info->attrs[NL80211_ATTR_TWT_RESPONDER]);
a0de1ca383c77a John Crispin              2019-05-28  5642  
796e90f42b7e52 John Crispin              2019-07-30  5643  	if (info->attrs[NL80211_ATTR_HE_OBSS_PD]) {
796e90f42b7e52 John Crispin              2019-07-30  5644  		err = nl80211_parse_he_obss_pd(
796e90f42b7e52 John Crispin              2019-07-30  5645  					info->attrs[NL80211_ATTR_HE_OBSS_PD],
796e90f42b7e52 John Crispin              2019-07-30  5646  					&params.he_obss_pd);
bc7a39b4272b96 Luca Coelho               2020-06-26  5647  		if (err)
9951ebfcdf2b97 Johannes Berg             2020-02-21  5648  			goto out;
796e90f42b7e52 John Crispin              2019-07-30  5649  	}
796e90f42b7e52 John Crispin              2019-07-30  5650  
5c5e52d1bb9625 John Crispin              2019-12-17  5651  	if (info->attrs[NL80211_ATTR_HE_BSS_COLOR]) {
5c5e52d1bb9625 John Crispin              2019-12-17  5652  		err = nl80211_parse_he_bss_color(
5c5e52d1bb9625 John Crispin              2019-12-17  5653  					info->attrs[NL80211_ATTR_HE_BSS_COLOR],
5c5e52d1bb9625 John Crispin              2019-12-17  5654  					&params.he_bss_color);
5c5e52d1bb9625 John Crispin              2019-12-17  5655  		if (err)
60a0121f8fa64b Luca Coelho               2020-06-26  5656  			goto out;
5c5e52d1bb9625 John Crispin              2019-12-17  5657  	}
5c5e52d1bb9625 John Crispin              2019-12-17  5658  
291c49ded2fda1 Aloka Dixit               2020-09-11  5659  	if (info->attrs[NL80211_ATTR_FILS_DISCOVERY]) {
291c49ded2fda1 Aloka Dixit               2020-09-11  5660  		err = nl80211_parse_fils_discovery(rdev,
291c49ded2fda1 Aloka Dixit               2020-09-11  5661  						   info->attrs[NL80211_ATTR_FILS_DISCOVERY],
291c49ded2fda1 Aloka Dixit               2020-09-11  5662  						   &params);
291c49ded2fda1 Aloka Dixit               2020-09-11  5663  		if (err)
291c49ded2fda1 Aloka Dixit               2020-09-11  5664  			goto out;
291c49ded2fda1 Aloka Dixit               2020-09-11  5665  	}
291c49ded2fda1 Aloka Dixit               2020-09-11  5666  
7443dcd1f1718a Aloka Dixit               2020-09-11  5667  	if (info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP]) {
7443dcd1f1718a Aloka Dixit               2020-09-11  5668  		err = nl80211_parse_unsol_bcast_probe_resp(
7443dcd1f1718a Aloka Dixit               2020-09-11  5669  			rdev, info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP],
7443dcd1f1718a Aloka Dixit               2020-09-11  5670  			&params);
7443dcd1f1718a Aloka Dixit               2020-09-11  5671  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5672  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5673  	}
1a41c96851bfa3 John Crispin              2021-03-08  5674  
1a41c96851bfa3 John Crispin              2021-03-08  5675  	if (info->attrs[NL80211_ATTR_MULTIPLE_BSSID_CONFIG]) {
1a41c96851bfa3 John Crispin              2021-03-08  5676  		err = nl80211_parse_multiple_bssid_config(
1a41c96851bfa3 John Crispin              2021-03-08  5677  			&rdev->wiphy,
1a41c96851bfa3 John Crispin              2021-03-08  5678  			info->attrs[NL80211_ATTR_MULTIPLE_BSSID_CONFIG],
1a41c96851bfa3 John Crispin              2021-03-08  5679  			&params);
1a41c96851bfa3 John Crispin              2021-03-08  5680  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5681  			goto out;
7443dcd1f1718a Aloka Dixit               2020-09-11  5682  	}
7443dcd1f1718a Aloka Dixit               2020-09-11  5683  
66cd794e3c30b8 Johannes Berg             2017-02-07  5684  	nl80211_calculate_ap_params(&params);
66cd794e3c30b8 Johannes Berg             2017-02-07  5685  
fe4943702c850f Srinivas Dasari           2019-01-23  5686  	if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])
fe4943702c850f Srinivas Dasari           2019-01-23  5687  		params.flags |= AP_SETTINGS_EXTERNAL_AUTH_SUPPORT;
fe4943702c850f Srinivas Dasari           2019-01-23  5688  
c56589ed1d25ae Simon Wunderlich          2013-11-21  5689  	wdev_lock(wdev);
e35e4d28b687d4 Hila Gonen                2012-06-27  5690  	err = rdev_start_ap(rdev, dev, &params);
46c1dd0c7fac54 Felix Fietkau             2012-06-19  5691  	if (!err) {
683b6d3b31a519 Johannes Berg             2012-11-08  5692  		wdev->preset_chandef = params.chandef;
8860020e0be1f0 Johannes Berg             2012-02-13  5693  		wdev->beacon_interval = params.beacon_interval;
9e0e29615a2077 Michal Kazior             2014-01-29  5694  		wdev->chandef = params.chandef;
06e191e22eb99c Antonio Quartulli         2012-11-07  5695  		wdev->ssid_len = params.ssid_len;
06e191e22eb99c Antonio Quartulli         2012-11-07  5696  		memcpy(wdev->ssid, params.ssid, wdev->ssid_len);
466a306142c002 Denis Kenzior             2018-03-26  5697  
466a306142c002 Denis Kenzior             2018-03-26  5698  		if (info->attrs[NL80211_ATTR_SOCKET_OWNER])
466a306142c002 Denis Kenzior             2018-03-26  5699  			wdev->conn_owner_nlportid = info->snd_portid;
46c1dd0c7fac54 Felix Fietkau             2012-06-19  5700  	}
c56589ed1d25ae Simon Wunderlich          2013-11-21  5701  	wdev_unlock(wdev);
77765eaf5cfb6b Vasanthakumar Thiagarajan 2013-01-18  5702  
9951ebfcdf2b97 Johannes Berg             2020-02-21  5703  out:
77765eaf5cfb6b Vasanthakumar Thiagarajan 2013-01-18 @5704  	kfree(params.acl);
                                                                      ^^^^^^^^^^
Dereferencing potential error pointer.  Freeing resources that weren't
allocated is one of the classic bugs with "out:" labels that free
everything.

1a41c96851bfa3 John Crispin              2021-03-08  5705  	kfree(params.beacon.multiple_bssid);
8860020e0be1f0 Johannes Berg             2012-02-13  5706  	return err;
ed1b6cc7f80f83 Johannes Berg             2007-12-19  5707  }

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41135 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v8 1/4] nl80211: add basic multiple bssid support
Date: Tue, 09 Mar 2021 09:40:20 +0300	[thread overview]
Message-ID: <20210309064020.GJ2087@kadam> (raw)
In-Reply-To: <20210309035437.6131-2-alokad@codeaurora.org>

[-- Attachment #1: Type: text/plain, Size: 23220 bytes --]

Hi Aloka,

url:    https://github.com/0day-ci/linux/commits/Aloka-Dixit/Multiple-BSSID-support/20210309-115621
base:   38b5133ad607ecdcc8d24906d1ac9cc8df41acd5
config: x86_64-randconfig-m001-20210309 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/wireless/nl80211.c:5704 nl80211_start_ap() error: 'params.acl' dereferencing possible ERR_PTR()

vim +5704 net/wireless/nl80211.c

8860020e0be1f0 Johannes Berg             2012-02-13  5448  static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
8860020e0be1f0 Johannes Berg             2012-02-13  5449  {
8860020e0be1f0 Johannes Berg             2012-02-13  5450  	struct cfg80211_registered_device *rdev = info->user_ptr[0];
8860020e0be1f0 Johannes Berg             2012-02-13  5451  	struct net_device *dev = info->user_ptr[1];
8860020e0be1f0 Johannes Berg             2012-02-13  5452  	struct wireless_dev *wdev = dev->ieee80211_ptr;
8860020e0be1f0 Johannes Berg             2012-02-13  5453  	struct cfg80211_ap_settings params;
8860020e0be1f0 Johannes Berg             2012-02-13  5454  	int err;
8860020e0be1f0 Johannes Berg             2012-02-13  5455  
074ac8df9f93f2 Johannes Berg             2010-09-16  5456  	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
4c476991062a0a Johannes Berg             2010-10-04  5457  	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
4c476991062a0a Johannes Berg             2010-10-04  5458  		return -EOPNOTSUPP;
eec60b037a8755 Jouni Malinen             2009-03-20  5459  
8860020e0be1f0 Johannes Berg             2012-02-13  5460  	if (!rdev->ops->start_ap)
8860020e0be1f0 Johannes Berg             2012-02-13  5461  		return -EOPNOTSUPP;
8860020e0be1f0 Johannes Berg             2012-02-13  5462  
8860020e0be1f0 Johannes Berg             2012-02-13  5463  	if (wdev->beacon_interval)
8860020e0be1f0 Johannes Berg             2012-02-13  5464  		return -EALREADY;
8860020e0be1f0 Johannes Berg             2012-02-13  5465  
56d1893d94bc06 Johannes Berg             2011-05-09  5466  	memset(&params, 0, sizeof(params));
56d1893d94bc06 Johannes Berg             2011-05-09  5467  
8860020e0be1f0 Johannes Berg             2012-02-13  5468  	/* these are required for START_AP */
ed1b6cc7f80f83 Johannes Berg             2007-12-19  5469  	if (!info->attrs[NL80211_ATTR_BEACON_INTERVAL] ||
ed1b6cc7f80f83 Johannes Berg             2007-12-19  5470  	    !info->attrs[NL80211_ATTR_DTIM_PERIOD] ||
4c476991062a0a Johannes Berg             2010-10-04  5471  	    !info->attrs[NL80211_ATTR_BEACON_HEAD])
4c476991062a0a Johannes Berg             2010-10-04  5472  		return -EINVAL;
ed1b6cc7f80f83 Johannes Berg             2007-12-19  5473  
81e54d08d9d845 Pradeep Kumar Chitrapu    2018-09-20  5474  	err = nl80211_parse_beacon(rdev, info->attrs, &params.beacon);
8860020e0be1f0 Johannes Berg             2012-02-13  5475  	if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5476  		goto out;
8860020e0be1f0 Johannes Berg             2012-02-13  5477  
8860020e0be1f0 Johannes Berg             2012-02-13  5478  	params.beacon_interval =
56d1893d94bc06 Johannes Berg             2011-05-09  5479  		nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
56d1893d94bc06 Johannes Berg             2011-05-09  5480  	params.dtim_period =
56d1893d94bc06 Johannes Berg             2011-05-09  5481  		nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);
56d1893d94bc06 Johannes Berg             2011-05-09  5482  
0c317a02ca982c Purushottam Kushwaha      2016-10-12  5483  	err = cfg80211_validate_beacon_int(rdev, dev->ieee80211_ptr->iftype,
0c317a02ca982c Purushottam Kushwaha      2016-10-12  5484  					   params.beacon_interval);
56d1893d94bc06 Johannes Berg             2011-05-09  5485  	if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5486  		goto out;
56d1893d94bc06 Johannes Berg             2011-05-09  5487  
32e9de846be885 Jouni Malinen             2011-08-10  5488  	/*
8860020e0be1f0 Johannes Berg             2012-02-13  5489  	 * In theory, some of these attributes should be required here
8860020e0be1f0 Johannes Berg             2012-02-13  5490  	 * but since they were not used when the command was originally
8860020e0be1f0 Johannes Berg             2012-02-13  5491  	 * added, keep them optional for old user space programs to let
8860020e0be1f0 Johannes Berg             2012-02-13  5492  	 * them continue to work with drivers that do not need the
8860020e0be1f0 Johannes Berg             2012-02-13  5493  	 * additional information -- drivers must check!
32e9de846be885 Jouni Malinen             2011-08-10  5494  	 */
32e9de846be885 Jouni Malinen             2011-08-10  5495  	if (info->attrs[NL80211_ATTR_SSID]) {
32e9de846be885 Jouni Malinen             2011-08-10  5496  		params.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]);
32e9de846be885 Jouni Malinen             2011-08-10  5497  		params.ssid_len =
32e9de846be885 Jouni Malinen             2011-08-10  5498  			nla_len(info->attrs[NL80211_ATTR_SSID]);
1a41c96851bfa3 John Crispin              2021-03-08  5499  		if (params.ssid_len == 0) {
1a41c96851bfa3 John Crispin              2021-03-08  5500  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5501  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5502  		}
32e9de846be885 Jouni Malinen             2011-08-10  5503  	}
32e9de846be885 Jouni Malinen             2011-08-10  5504  
ab0d76f6823cc3 Johannes Berg             2018-10-02  5505  	if (info->attrs[NL80211_ATTR_HIDDEN_SSID])
32e9de846be885 Jouni Malinen             2011-08-10  5506  		params.hidden_ssid = nla_get_u32(
32e9de846be885 Jouni Malinen             2011-08-10  5507  			info->attrs[NL80211_ATTR_HIDDEN_SSID]);
32e9de846be885 Jouni Malinen             2011-08-10  5508  
5fb628e9105eef Jouni Malinen             2011-08-10  5509  	params.privacy = !!info->attrs[NL80211_ATTR_PRIVACY];
5fb628e9105eef Jouni Malinen             2011-08-10  5510  
5fb628e9105eef Jouni Malinen             2011-08-10  5511  	if (info->attrs[NL80211_ATTR_AUTH_TYPE]) {
5fb628e9105eef Jouni Malinen             2011-08-10  5512  		params.auth_type = nla_get_u32(
5fb628e9105eef Jouni Malinen             2011-08-10  5513  			info->attrs[NL80211_ATTR_AUTH_TYPE]);
e39e5b5e720676 Jouni Malinen             2012-09-30  5514  		if (!nl80211_valid_auth_type(rdev, params.auth_type,
1a41c96851bfa3 John Crispin              2021-03-08  5515  					     NL80211_CMD_START_AP)) {
1a41c96851bfa3 John Crispin              2021-03-08  5516  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5517  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5518  		}
5fb628e9105eef Jouni Malinen             2011-08-10  5519  	} else
5fb628e9105eef Jouni Malinen             2011-08-10  5520  		params.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
5fb628e9105eef Jouni Malinen             2011-08-10  5521  
5fb628e9105eef Jouni Malinen             2011-08-10  5522  	err = nl80211_crypto_settings(rdev, info, &params.crypto,
5fb628e9105eef Jouni Malinen             2011-08-10  5523  				      NL80211_MAX_NR_CIPHER_SUITES);
5fb628e9105eef Jouni Malinen             2011-08-10  5524  	if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5525  		goto out;
5fb628e9105eef Jouni Malinen             2011-08-10  5526  
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5527  	if (info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]) {
1a41c96851bfa3 John Crispin              2021-03-08  5528  		if (!(rdev->wiphy.features &
1a41c96851bfa3 John Crispin              2021-03-08  5529  		      NL80211_FEATURE_INACTIVITY_TIMER)) {
1a41c96851bfa3 John Crispin              2021-03-08  5530  			err = -EOPNOTSUPP;
1a41c96851bfa3 John Crispin              2021-03-08  5531  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5532  		}
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5533  		params.inactivity_timeout = nla_get_u16(
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5534  			info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]);
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5535  	}
1b658f118b11de Vasanthakumar Thiagarajan 2012-03-02  5536  
53cabad70ecf0c Johannes Berg             2012-11-14  5537  	if (info->attrs[NL80211_ATTR_P2P_CTWINDOW]) {
1a41c96851bfa3 John Crispin              2021-03-08  5538  		if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) {
1a41c96851bfa3 John Crispin              2021-03-08  5539  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5540  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5541  		}
53cabad70ecf0c Johannes Berg             2012-11-14  5542  		params.p2p_ctwindow =
53cabad70ecf0c Johannes Berg             2012-11-14  5543  			nla_get_u8(info->attrs[NL80211_ATTR_P2P_CTWINDOW]);
53cabad70ecf0c Johannes Berg             2012-11-14  5544  		if (params.p2p_ctwindow != 0 &&
1a41c96851bfa3 John Crispin              2021-03-08  5545  		    !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN)) {
1a41c96851bfa3 John Crispin              2021-03-08  5546  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5547  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5548  		}
53cabad70ecf0c Johannes Berg             2012-11-14  5549  	}
53cabad70ecf0c Johannes Berg             2012-11-14  5550  
53cabad70ecf0c Johannes Berg             2012-11-14  5551  	if (info->attrs[NL80211_ATTR_P2P_OPPPS]) {
53cabad70ecf0c Johannes Berg             2012-11-14  5552  		u8 tmp;
53cabad70ecf0c Johannes Berg             2012-11-14  5553  
1a41c96851bfa3 John Crispin              2021-03-08  5554  		if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) {
1a41c96851bfa3 John Crispin              2021-03-08  5555  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5556  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5557  		}
53cabad70ecf0c Johannes Berg             2012-11-14  5558  		tmp = nla_get_u8(info->attrs[NL80211_ATTR_P2P_OPPPS]);
53cabad70ecf0c Johannes Berg             2012-11-14  5559  		params.p2p_opp_ps = tmp;
53cabad70ecf0c Johannes Berg             2012-11-14  5560  		if (params.p2p_opp_ps != 0 &&
1a41c96851bfa3 John Crispin              2021-03-08  5561  		    !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS)) {
1a41c96851bfa3 John Crispin              2021-03-08  5562  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5563  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5564  		}
53cabad70ecf0c Johannes Berg             2012-11-14  5565  	}
53cabad70ecf0c Johannes Berg             2012-11-14  5566  
aa430da41019c1 Johannes Berg             2012-05-16  5567  	if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) {
683b6d3b31a519 Johannes Berg             2012-11-08  5568  		err = nl80211_parse_chandef(rdev, info, &params.chandef);
683b6d3b31a519 Johannes Berg             2012-11-08  5569  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5570  			goto out;
683b6d3b31a519 Johannes Berg             2012-11-08  5571  	} else if (wdev->preset_chandef.chan) {
683b6d3b31a519 Johannes Berg             2012-11-08  5572  		params.chandef = wdev->preset_chandef;
1a41c96851bfa3 John Crispin              2021-03-08  5573  	} else if (!nl80211_get_ap_channel(rdev, &params)) {
1a41c96851bfa3 John Crispin              2021-03-08  5574  		err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5575  		goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5576  	}
aa430da41019c1 Johannes Berg             2012-05-16  5577  
923b352f19d9ea Arik Nemtsov              2015-07-08  5578  	if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &params.chandef,
1a41c96851bfa3 John Crispin              2021-03-08  5579  					   wdev->iftype)) {
1a41c96851bfa3 John Crispin              2021-03-08  5580  		err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5581  		goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5582  	}
aa430da41019c1 Johannes Berg             2012-05-16  5583  
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5584  	if (info->attrs[NL80211_ATTR_TX_RATES]) {
9a5f6488623730 Tamizh Chelvam            2020-05-13  5585  		err = nl80211_parse_tx_bitrate_mask(info, info->attrs,
9a5f6488623730 Tamizh Chelvam            2020-05-13  5586  						    NL80211_ATTR_TX_RATES,
eb89a6a6b7a1af Miles Hu                  2020-08-04  5587  						    &params.beacon_rate,
857b34c4fb104c Rajkumar Manoharan        2020-10-16  5588  						    dev, false);
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5589  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5590  			goto out;
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5591  
8564e38206de2f Johannes Berg             2016-09-19  5592  		err = validate_beacon_tx_rate(rdev, params.chandef.chan->band,
8564e38206de2f Johannes Berg             2016-09-19  5593  					      &params.beacon_rate);
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5594  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5595  			goto out;
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5596  	}
a7c7fbff6a408d Purushottam Kushwaha      2016-09-14  5597  
18998c381b19bf Eliad Peller              2014-09-10  5598  	if (info->attrs[NL80211_ATTR_SMPS_MODE]) {
18998c381b19bf Eliad Peller              2014-09-10  5599  		params.smps_mode =
18998c381b19bf Eliad Peller              2014-09-10  5600  			nla_get_u8(info->attrs[NL80211_ATTR_SMPS_MODE]);
18998c381b19bf Eliad Peller              2014-09-10  5601  		switch (params.smps_mode) {
18998c381b19bf Eliad Peller              2014-09-10  5602  		case NL80211_SMPS_OFF:
18998c381b19bf Eliad Peller              2014-09-10  5603  			break;
18998c381b19bf Eliad Peller              2014-09-10  5604  		case NL80211_SMPS_STATIC:
18998c381b19bf Eliad Peller              2014-09-10  5605  			if (!(rdev->wiphy.features &
1a41c96851bfa3 John Crispin              2021-03-08  5606  			      NL80211_FEATURE_STATIC_SMPS)) {
1a41c96851bfa3 John Crispin              2021-03-08  5607  				err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5608  				goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5609  			}
18998c381b19bf Eliad Peller              2014-09-10  5610  			break;
18998c381b19bf Eliad Peller              2014-09-10  5611  		case NL80211_SMPS_DYNAMIC:
18998c381b19bf Eliad Peller              2014-09-10  5612  			if (!(rdev->wiphy.features &
1a41c96851bfa3 John Crispin              2021-03-08  5613  			      NL80211_FEATURE_DYNAMIC_SMPS)) {
1a41c96851bfa3 John Crispin              2021-03-08  5614  				err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5615  				goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5616  			}
18998c381b19bf Eliad Peller              2014-09-10  5617  			break;
18998c381b19bf Eliad Peller              2014-09-10  5618  		default:
1a41c96851bfa3 John Crispin              2021-03-08  5619  			err = -EINVAL;
1a41c96851bfa3 John Crispin              2021-03-08  5620  			goto out;
18998c381b19bf Eliad Peller              2014-09-10  5621  		}
18998c381b19bf Eliad Peller              2014-09-10  5622  	} else {
18998c381b19bf Eliad Peller              2014-09-10  5623  		params.smps_mode = NL80211_SMPS_OFF;
18998c381b19bf Eliad Peller              2014-09-10  5624  	}
18998c381b19bf Eliad Peller              2014-09-10  5625  
6e8ef842223b90 Purushottam Kushwaha      2016-07-05  5626  	params.pbss = nla_get_flag(info->attrs[NL80211_ATTR_PBSS]);
1a41c96851bfa3 John Crispin              2021-03-08  5627  	if (params.pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ]) {
1a41c96851bfa3 John Crispin              2021-03-08  5628  		err = -EOPNOTSUPP;
1a41c96851bfa3 John Crispin              2021-03-08  5629  		goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5630  	}
6e8ef842223b90 Purushottam Kushwaha      2016-07-05  5631  
4baf6bea37247e Ola Olsson                2015-10-29  5632  	if (info->attrs[NL80211_ATTR_ACL_POLICY]) {
4baf6bea37247e Ola Olsson                2015-10-29  5633  		params.acl = parse_acl_data(&rdev->wiphy, info);
1a41c96851bfa3 John Crispin              2021-03-08  5634  		if (IS_ERR(params.acl)) {
1a41c96851bfa3 John Crispin              2021-03-08  5635  			err = PTR_ERR(params.acl);

params.acl is an error pointer.

1a41c96851bfa3 John Crispin              2021-03-08  5636  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5637  		}
4baf6bea37247e Ola Olsson                2015-10-29  5638  	}
4baf6bea37247e Ola Olsson                2015-10-29  5639  
a0de1ca383c77a John Crispin              2019-05-28  5640  	params.twt_responder =
a0de1ca383c77a John Crispin              2019-05-28  5641  		    nla_get_flag(info->attrs[NL80211_ATTR_TWT_RESPONDER]);
a0de1ca383c77a John Crispin              2019-05-28  5642  
796e90f42b7e52 John Crispin              2019-07-30  5643  	if (info->attrs[NL80211_ATTR_HE_OBSS_PD]) {
796e90f42b7e52 John Crispin              2019-07-30  5644  		err = nl80211_parse_he_obss_pd(
796e90f42b7e52 John Crispin              2019-07-30  5645  					info->attrs[NL80211_ATTR_HE_OBSS_PD],
796e90f42b7e52 John Crispin              2019-07-30  5646  					&params.he_obss_pd);
bc7a39b4272b96 Luca Coelho               2020-06-26  5647  		if (err)
9951ebfcdf2b97 Johannes Berg             2020-02-21  5648  			goto out;
796e90f42b7e52 John Crispin              2019-07-30  5649  	}
796e90f42b7e52 John Crispin              2019-07-30  5650  
5c5e52d1bb9625 John Crispin              2019-12-17  5651  	if (info->attrs[NL80211_ATTR_HE_BSS_COLOR]) {
5c5e52d1bb9625 John Crispin              2019-12-17  5652  		err = nl80211_parse_he_bss_color(
5c5e52d1bb9625 John Crispin              2019-12-17  5653  					info->attrs[NL80211_ATTR_HE_BSS_COLOR],
5c5e52d1bb9625 John Crispin              2019-12-17  5654  					&params.he_bss_color);
5c5e52d1bb9625 John Crispin              2019-12-17  5655  		if (err)
60a0121f8fa64b Luca Coelho               2020-06-26  5656  			goto out;
5c5e52d1bb9625 John Crispin              2019-12-17  5657  	}
5c5e52d1bb9625 John Crispin              2019-12-17  5658  
291c49ded2fda1 Aloka Dixit               2020-09-11  5659  	if (info->attrs[NL80211_ATTR_FILS_DISCOVERY]) {
291c49ded2fda1 Aloka Dixit               2020-09-11  5660  		err = nl80211_parse_fils_discovery(rdev,
291c49ded2fda1 Aloka Dixit               2020-09-11  5661  						   info->attrs[NL80211_ATTR_FILS_DISCOVERY],
291c49ded2fda1 Aloka Dixit               2020-09-11  5662  						   &params);
291c49ded2fda1 Aloka Dixit               2020-09-11  5663  		if (err)
291c49ded2fda1 Aloka Dixit               2020-09-11  5664  			goto out;
291c49ded2fda1 Aloka Dixit               2020-09-11  5665  	}
291c49ded2fda1 Aloka Dixit               2020-09-11  5666  
7443dcd1f1718a Aloka Dixit               2020-09-11  5667  	if (info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP]) {
7443dcd1f1718a Aloka Dixit               2020-09-11  5668  		err = nl80211_parse_unsol_bcast_probe_resp(
7443dcd1f1718a Aloka Dixit               2020-09-11  5669  			rdev, info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP],
7443dcd1f1718a Aloka Dixit               2020-09-11  5670  			&params);
7443dcd1f1718a Aloka Dixit               2020-09-11  5671  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5672  			goto out;
1a41c96851bfa3 John Crispin              2021-03-08  5673  	}
1a41c96851bfa3 John Crispin              2021-03-08  5674  
1a41c96851bfa3 John Crispin              2021-03-08  5675  	if (info->attrs[NL80211_ATTR_MULTIPLE_BSSID_CONFIG]) {
1a41c96851bfa3 John Crispin              2021-03-08  5676  		err = nl80211_parse_multiple_bssid_config(
1a41c96851bfa3 John Crispin              2021-03-08  5677  			&rdev->wiphy,
1a41c96851bfa3 John Crispin              2021-03-08  5678  			info->attrs[NL80211_ATTR_MULTIPLE_BSSID_CONFIG],
1a41c96851bfa3 John Crispin              2021-03-08  5679  			&params);
1a41c96851bfa3 John Crispin              2021-03-08  5680  		if (err)
1a41c96851bfa3 John Crispin              2021-03-08  5681  			goto out;
7443dcd1f1718a Aloka Dixit               2020-09-11  5682  	}
7443dcd1f1718a Aloka Dixit               2020-09-11  5683  
66cd794e3c30b8 Johannes Berg             2017-02-07  5684  	nl80211_calculate_ap_params(&params);
66cd794e3c30b8 Johannes Berg             2017-02-07  5685  
fe4943702c850f Srinivas Dasari           2019-01-23  5686  	if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])
fe4943702c850f Srinivas Dasari           2019-01-23  5687  		params.flags |= AP_SETTINGS_EXTERNAL_AUTH_SUPPORT;
fe4943702c850f Srinivas Dasari           2019-01-23  5688  
c56589ed1d25ae Simon Wunderlich          2013-11-21  5689  	wdev_lock(wdev);
e35e4d28b687d4 Hila Gonen                2012-06-27  5690  	err = rdev_start_ap(rdev, dev, &params);
46c1dd0c7fac54 Felix Fietkau             2012-06-19  5691  	if (!err) {
683b6d3b31a519 Johannes Berg             2012-11-08  5692  		wdev->preset_chandef = params.chandef;
8860020e0be1f0 Johannes Berg             2012-02-13  5693  		wdev->beacon_interval = params.beacon_interval;
9e0e29615a2077 Michal Kazior             2014-01-29  5694  		wdev->chandef = params.chandef;
06e191e22eb99c Antonio Quartulli         2012-11-07  5695  		wdev->ssid_len = params.ssid_len;
06e191e22eb99c Antonio Quartulli         2012-11-07  5696  		memcpy(wdev->ssid, params.ssid, wdev->ssid_len);
466a306142c002 Denis Kenzior             2018-03-26  5697  
466a306142c002 Denis Kenzior             2018-03-26  5698  		if (info->attrs[NL80211_ATTR_SOCKET_OWNER])
466a306142c002 Denis Kenzior             2018-03-26  5699  			wdev->conn_owner_nlportid = info->snd_portid;
46c1dd0c7fac54 Felix Fietkau             2012-06-19  5700  	}
c56589ed1d25ae Simon Wunderlich          2013-11-21  5701  	wdev_unlock(wdev);
77765eaf5cfb6b Vasanthakumar Thiagarajan 2013-01-18  5702  
9951ebfcdf2b97 Johannes Berg             2020-02-21  5703  out:
77765eaf5cfb6b Vasanthakumar Thiagarajan 2013-01-18 @5704  	kfree(params.acl);
                                                                      ^^^^^^^^^^
Dereferencing potential error pointer.  Freeing resources that weren't
allocated is one of the classic bugs with "out:" labels that free
everything.

1a41c96851bfa3 John Crispin              2021-03-08  5705  	kfree(params.beacon.multiple_bssid);
8860020e0be1f0 Johannes Berg             2012-02-13  5706  	return err;
ed1b6cc7f80f83 Johannes Berg             2007-12-19  5707  }

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41135 bytes --]

  reply	other threads:[~2021-03-09  6:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09  3:54 [PATCH v8 0/4] Multiple BSSID support Aloka Dixit
2021-03-09  3:54 ` [PATCH v8 1/4] nl80211: add basic multiple bssid support Aloka Dixit
2021-03-09  6:40   ` Dan Carpenter [this message]
2021-03-09  6:40     ` Dan Carpenter
2021-03-09  6:40     ` Dan Carpenter
2021-03-09  3:54 ` [PATCH v8 2/4] mac80211: add multiple bssid support to interface handling Aloka Dixit
2021-03-09  3:54 ` [PATCH v8 3/4] mac80211: add multiple bssid/EMA support to beacon handling Aloka Dixit
2021-03-09  3:54 ` [PATCH v8 4/4] mac80211: CSA on non-transmitting interfaces Aloka Dixit
  -- strict thread matches above, loose matches on Subject: below --
2021-03-09  5:42 [PATCH v8 1/4] nl80211: add basic multiple bssid support kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210309064020.GJ2087@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.