Jelajahi Sumber

qcacld-3.0: Handle ch cnt and number of channels for SETROAMSCANCHANNELS

To set specific channels, user give SETROAMSCANCHANNELS command with
channel count followed by number of channels.
Ex. SETROAMSCANCHANNELS 2 1 11, here 2 is count and 1 & 11 are the
channels.

If channel count is more than the number of channels, driver rejects
SETROAMSCANCHANNELS command and if number of channels are more than
the channel count, driver ignores excess channels in the list.

Change-Id: I276b84b4994bdf25abf36298dc212dcd54ce0dbb
CRs-Fixed: 2609788
Abhishek Ambure 5 tahun lalu
induk
melakukan
f4e994656f
1 mengubah file dengan 12 tambahan dan 10 penghapusan
  1. 12 10
      core/hdd/src/wlan_hdd_ioctl.c

+ 12 - 10
core/hdd/src/wlan_hdd_ioctl.c

@@ -1880,12 +1880,10 @@ hdd_parse_channellist(struct hdd_context *hdd_ctx,
 		in_ptr = strpbrk(in_ptr, " ");
 		/* no channel list after the number of channels argument */
 		if (!in_ptr) {
-			if (0 != j) {
-				*num_channels = j;
+			if ((j != 0) && (*num_channels == j))
 				return 0;
-			} else {
-				return -EINVAL;
-			}
+			else
+				goto cnt_mismatch;
 		}
 
 		/* remove empty space */
@@ -1897,12 +1895,10 @@ hdd_parse_channellist(struct hdd_context *hdd_ctx,
 		 * argument and spaces
 		 */
 		if ('\0' == *in_ptr) {
-			if (0 != j) {
-				*num_channels = j;
+			if ((j != 0) && (*num_channels == j))
 				return 0;
-			} else {
-				return -EINVAL;
-			}
+			else
+				goto cnt_mismatch;
 		}
 
 		v = sscanf(in_ptr, "%31s ", buf);
@@ -1923,6 +1919,12 @@ hdd_parse_channellist(struct hdd_context *hdd_ctx,
 	}
 
 	return 0;
+
+cnt_mismatch:
+	hdd_debug("Mismatch in ch cnt: %d and num of ch: %d", *num_channels, j);
+	*num_channels = 0;
+	return -EINVAL;
+
 }
 
 /**