Unverified Commit 8498e656 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!10612 wifi: cfg80211: wext: add extra SIOCSIWSCAN data check

parents 13856a4a 0878a163
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -2772,10 +2772,14 @@ int cfg80211_wext_siwscan(struct net_device *dev,
	wiphy = &rdev->wiphy;

	/* Determine number of channels, needed to allocate creq */
	if (wreq && wreq->num_channels)
	if (wreq && wreq->num_channels) {
		/* Passed from userspace so should be checked */
		if (unlikely(wreq->num_channels > IW_MAX_FREQUENCIES))
			return -EINVAL;
		n_channels = wreq->num_channels;
	else
	} else {
		n_channels = ieee80211_get_num_supported_channels(wiphy);
	}

	creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) +
		       n_channels * sizeof(void *),